Added "animate" binding, fixes #70

This commit is contained in:
Devine Lu Linvega
2019-07-22 14:50:05 +09:00
parent 00dc10894e
commit 7e99df545e
10 changed files with 46 additions and 54 deletions

View File

@@ -1,6 +1,3 @@
;
(clear)
;
(def seg-count 50)
;
(def frame-middle
@@ -47,4 +44,9 @@
(frame) :w) 0)
("rgba(255,255,255,0)" "white" "#72dec2" "red")))))
;
(times seg-count draw-dash)
(defn redraw
()
(
(clear)
(times seg-count draw-dash)))
(on "animate" redraw)

View File

@@ -1,14 +0,0 @@
; filesystem
; print path
(echo
(filepath))
; print folder path
(echo
(dirpath))
; print file content
(echo
(file))
; print folder content
(echo
(dir))

View File

@@ -56,4 +56,13 @@
; Interop
(test "interop" ((of (of (js) "Math") "max") 2 4) 4)
(test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
(test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
; fs
; filesystem
(echo (filepath))
(echo (dirpath))
(echo (file))
(echo (dir))

View File

@@ -1 +0,0 @@
(echo (map '(add %1 2) (4 5 6))

View File

@@ -12,4 +12,6 @@
(echo (values ob))
(set ob :a 4)
(echo (of ob :a))
(echo (of ob :a))
(echo (map '(add %1 2) (4 5 6))

View File

@@ -1,13 +1,24 @@
;
(def ring
(circle 300 300 150))
;
(defn redraw
()
(
(clear)
(stroke ring 2 "red")))
;
(defn on-msg
(msg)
(
(clear)
(def msg-value
(of
(first msg) :value))
(stroke
(circle 300 300 150) 2
(if
(eq msg-value 1) "#ffb545" "#72dec2" ))))
(set ring :r 150)))
; frame
(set ring :r
(sub
(of ring :r) 1))
(redraw)
; trigger
(on "/a" on-msg)