Better animate

This commit is contained in:
Devine Lu Linvega 2019-07-21 20:35:00 +09:00
parent bb887ae6c3
commit f994ae30d3

View File

@ -1,9 +1,9 @@
; ;
(clear) (clear)
; ;
(def seg-count 20) (def seg-count 50)
; ;
(def center (def frame-middle
(div (div
(of (of
(frame) :h) 2)) (frame) :h) 2))
@ -11,7 +11,19 @@
(def seg-width (def seg-width
(div (div
(of (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 (defn draw-dash
(i) (i)
@ -20,15 +32,19 @@
(mul (mul
(sub i 1) seg-width)) (sub i 1) seg-width))
(def y (def y
(add (elevation i))
(mul
(sin
(add
(time 0.01) i)) 15) center))
(stroke (stroke
(line (line
(pos x y) (pos x
(elevation
(sub i 1)))
(pos (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) (times seg-count draw-dash)