Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working on-animate example #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions examples/events/on-animate.lisp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
; this demo shows how to use the animate event to animate lines into a sine wave.

;
(def seg-count 50)
;
(def seg-width
(div frame:w seg-count))
(div frame:w seg-count))
;
(defn elevation
(i)
Expand All @@ -13,29 +14,35 @@
(add
(time 0.001)
(div i 5)))
(div frame:h 5)) frame:m))
(div frame:h 5)) 300))
;
(defn draw-dash
(i)
(
(def x
(mul
(sub i 1) seg-width))
(def y
(elevation i))
(stroke
(line x
(elevation
(sub i 1))
(add x seg-width)
(if
(gt i 0)
(
(def x
(mul
(sub i 1) seg-width))
(def y
(elevation i))
(gradient
(line 50 0 frame:w 0)
("#ffb545" "#72dec2")) 4 )))
(stroke
(line x
(elevation
(sub i 1))
(add x seg-width)
(elevation i))
(gradient
(line 50 0 frame:w 0)
("#ffb545" "#72dec2")) 4)
(draw-dash
(sub i 1))) ))

;
(defn redraw
()
(defn redraw ()
(

(clear)
(times seg-count draw-dash)))
(on "animate" redraw)
(draw-dash seg-count)))

(on "animate" redraw)