Skip to content

setanarut/gog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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