Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 973 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 973 Bytes

GoDoc

GOG v2

GOG is a Go Object-oriented 2d drawing library for creative coding and generative art

curve_anim

Examples

Path follow animation

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)

path_follow

See folder examples for all examples