示例#1
0
文件: app.go 项目: influx6/govfx
func main() {

	div := govfx.Document().QuerySelector(".expandable")
	expand := govfx.NewElement(div, "")

	report("margin-top", one(expand.Read("margin-top")))
	report("margin-left", one(expand.Read("margin-left")))

	expand.Write("margin-left", "10px", false)
	expand.Write("margin-top", "40px", true)

	<-time.After(500 * time.Millisecond)

	expand.Write("background-color", "red", true)

	report("margin-top", one(expand.Read("margin-top")))
	report("margin-left", one(expand.Read("margin-left")))

	<-time.After(500 * time.Millisecond)
	expand.Sync()

	<-time.After(500 * time.Millisecond)
	expand.Write("padding-left", "40px", true)
	expand.Write("padding-bottom", "40px", true)
	expand.Write("padding-right", "40px", true)
	expand.Write("padding-top", "40px", true)

	expand.Sync()

	report("margin-top", one(expand.Read("margin-top")))
	report("margin-left", one(expand.Read("margin-left")))

}
示例#2
0
文件: app.go 项目: influx6/govfx
func main() {

	div := govfx.Document().QuerySelector("div.offset")

	top, left := govfx.Offset(div)
	ptop, pleft := govfx.Position(div)

	color := "#cccccc"
	scolor := "#ccc"

	div.SetInnerHTML(fmt.Sprintf(`
    Offset: %.2f %.2f
    <br/>
    Position: %.2f %.2f
    <br/>
    Color: Hex(%s) Rgba(%s)
    <br/>
    Color: Hex(%s) Rgba(%s)
    <br/>
  `, top, left, ptop, pleft, color, govfx.RGBA(color, 50), scolor, govfx.RGBA(scolor, 50)))
}