automated snapshot
This commit is contained in:
16
main.go
16
main.go
@@ -58,9 +58,9 @@ func main() {
|
||||
w := rl.GetRenderWidth()
|
||||
h := rl.GetRenderHeight()
|
||||
|
||||
angles := make([]float32, 1000)
|
||||
angles := make([]float32, 2000)
|
||||
noise := opensimplex.NewNormalized(0)
|
||||
r := 0.75
|
||||
r := 2.0
|
||||
dtheta := 360.0/float64(len(angles))
|
||||
for i := range len(angles) {
|
||||
rad := float64(i) * dtheta * math.Pi / 180.0
|
||||
@@ -70,12 +70,12 @@ func main() {
|
||||
}
|
||||
|
||||
sketches := []Sketch{
|
||||
&SierpinskiArrow{},
|
||||
&Worm{
|
||||
position: rl.Vector2 { X: 50, Y: 50 },
|
||||
angles: angles,
|
||||
angleIndex: 0,
|
||||
stepSize: 2,
|
||||
stepSize: 1,
|
||||
renderPct: 0.1,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -141,8 +141,6 @@ func main() {
|
||||
|
||||
rl.EndMode2D()
|
||||
|
||||
rl.DrawLine(10, 10, int32(w-10), int32(h-10), rl.Black)
|
||||
|
||||
// HUD
|
||||
rl.DrawText("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, rl.Black)
|
||||
rl.EndDrawing()
|
||||
@@ -189,12 +187,14 @@ type Worm struct {
|
||||
angles []float32
|
||||
angleIndex int
|
||||
stepSize int
|
||||
renderPct float32
|
||||
}
|
||||
|
||||
func (w *Worm) Draw(ctx *RenderCtx) {
|
||||
rl.PushMatrix()
|
||||
rl.Translatef(w.position.X, w.position.Y, 0)
|
||||
lastAngle := float32(0.0)
|
||||
stepCount := 0
|
||||
for i := range w.angles {
|
||||
ii := (i + w.angleIndex) % len(w.angles)
|
||||
angle := w.angles[ii]
|
||||
@@ -202,6 +202,10 @@ func (w *Worm) Draw(ctx *RenderCtx) {
|
||||
rl.DrawLine(0, 0, int32(w.stepSize), 0, rl.Black)
|
||||
rl.Translatef(float32(w.stepSize), 0, 0)
|
||||
lastAngle = angle
|
||||
stepCount++
|
||||
if stepCount > int(float32(len(w.angles))*w.renderPct) {
|
||||
break
|
||||
}
|
||||
}
|
||||
rl.PopMatrix()
|
||||
w.angleIndex = (w.angleIndex + 1) % len(w.angles)
|
||||
|
||||
Reference in New Issue
Block a user