Merge pull request #137 from blad/fix-on-animate-example

Fix on-animate Example
This commit is contained in:
Devine Lu Linvega 2020-08-21 22:51:41 -07:00 committed by GitHub
commit 211762ebcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
; this demo shows how to use the animate event to animate lines into a sine wave. ; this demo shows how to use the animate event to animate lines into a sine wave.
(def frame (get-frame))
; ;
(def seg-count 50) (def seg-count 100)
; ;
(def seg-width (def seg-width
(div frame:w seg-count)) (div frame:w seg-count))
@ -22,7 +23,7 @@
(mul (mul
(sub i 1) seg-width)) (sub i 1) seg-width))
(def y (def y
(elevation i)) (elevation i))
(stroke (stroke
(line x (line x
(elevation (elevation
@ -36,6 +37,7 @@
(defn redraw (defn redraw
() ()
( (
(clear) (clear)
(times seg-count draw-dash))) (each (range 0 seg-count) draw-dash)))
(on "animate" redraw) ;
(on "animate" redraw)