Пример #1
0
func main() {

	// Create nested views.

	dflt := vu.Frame(voronoi.New())
	frame := vu.Frame(vu.Landscape(dflt))
	vbox := vu.Vbox(dflt, vu.Stack(frame, vu.Cube(vu.Spin(vu.NewScatter(points())))))
	wiggle := vu.Wiggle(vu.Frame(vu.Hbox(vu.Portrait(dflt), vbox)))
	w, err := vu.NewWindow(wiggle)
	if err != nil {
		panic("NewWindow failed")
	}

	// Render them until the window is closed.

	for {
		w.Render()
	}
}
Пример #2
0
func main() {
	world := p11.NewWorld(20)
	agent := agent.New()
	window, err := vu.NewWindow(vu.Flat(vu.Frame(world)))
	if err != nil {
		panic(err)
	}
	for {
		world.Step(agent)
		window.Render()
		time.Sleep(300 * time.Second)
	}
}