GOG is a Go Object-oriented 2d drawing library for creative coding and generative art
ctx := gog.NewContext(250, 100)
rect := shapes.Rect(vec.Vec2{}, 30, 10)
lemn := shapes.Lemniscate(100, 100).SetPos(ctx.Center)
lemnTotalLength := lemn.Length()
for _, length := range utils.Linspace(0, lemnTotalLength, 120) {
ctx.Clear(color.Black)
ctx.Stroke(lemn, gog.DefaultStrokeStyle())
pos, ang := lemn.PointAngleAtLength(length)
ctx.Fill(rect.SetPos(pos).Rotated(ang), color.White)
ctx.AppendAnimationFrame()
}
ctx.SaveAPNG("path_follow.png", 2)
See folder examples for all examples