From 8adb4cd59822a1c88ad94e872b8a6bf9b7594801 Mon Sep 17 00:00:00 2001 From: SushilRagoonath <48589447+SushilRagoonath@users.noreply.github.com> Date: Thu, 9 Jul 2020 21:08:02 +0200 Subject: [PATCH 1/2] Update on-animate.lisp --- examples/events/on-animate.lisp | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/examples/events/on-animate.lisp b/examples/events/on-animate.lisp index 276fa84f..8d733306 100644 --- a/examples/events/on-animate.lisp +++ b/examples/events/on-animate.lisp @@ -1,9 +1,14 @@ ; 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) @@ -13,29 +18,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) \ No newline at end of file + (draw-dash seg-count))) + +(on "animate" redraw) From 9149f46fc9b066f8abfea5a4c5a64d2eba3e0e86 Mon Sep 17 00:00:00 2001 From: SushilRagoonath <48589447+SushilRagoonath@users.noreply.github.com> Date: Thu, 9 Jul 2020 21:08:36 +0200 Subject: [PATCH 2/2] Update on-animate.lisp --- examples/events/on-animate.lisp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/events/on-animate.lisp b/examples/events/on-animate.lisp index 8d733306..67cfabff 100644 --- a/examples/events/on-animate.lisp +++ b/examples/events/on-animate.lisp @@ -2,13 +2,9 @@ ; (def seg-count 50) - - ; - (def seg-width (div frame:w seg-count)) - ; (defn elevation (i) @@ -19,7 +15,7 @@ (time 0.001) (div i 5))) (div frame:h 5)) 300)) - +; (defn draw-dash (i) (if