From f994ae30d36d183597f008ef0f2d9b6e5bd3f9ef Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 21 Jul 2019 20:35:00 +0900 Subject: [PATCH] Better animate --- examples/animate.lisp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/examples/animate.lisp b/examples/animate.lisp index 98e6c41..7943d97 100644 --- a/examples/animate.lisp +++ b/examples/animate.lisp @@ -1,9 +1,9 @@ ; (clear) ; -(def seg-count 20) +(def seg-count 50) ; -(def center +(def frame-middle (div (of (frame) :h) 2)) @@ -11,7 +11,19 @@ (def seg-width (div (of - (frame) :w) count)) + (frame) :w) seg-count)) +; +(defn elevation + (i) + (add + (mul + (sin + (add + (time 0.001) + (div i 5))) + (div + (of + (frame) :h) 5)) frame-middle)) ; (defn draw-dash (i) @@ -20,15 +32,19 @@ (mul (sub i 1) seg-width)) (def y - (add - (mul - (sin - (add - (time 0.01) i)) 15) center)) + (elevation i)) (stroke (line - (pos x y) + (pos x + (elevation + (sub i 1))) (pos - (add x seg-width) y)) 4 "red"))) + (add x seg-width) + (elevation i))) 4 + (gradient + (50 0 + (of + (frame) :w) 0) + ("rgba(255,255,255,0)" "white" "#72dec2" "red"))))) ; (times seg-count draw-dash) \ No newline at end of file