diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 14e96b7..1ea70c6 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -1,4 +1,5 @@ function Library (ronin) { + console.log(ronin) this.open = async (path) => { return ronin.surface.open(path) } @@ -326,12 +327,15 @@ function Library (ronin) { return a === b } + // Client + this.ronin = ronin + // Livecoding this.time = Date.now + this.animate = (b = true) => ronin.animate(b) + // javascript interop this.js = window - // Client - this.ronin = ronin } diff --git a/documentation.md b/documentation.md index 13fb4e4..706fee5 100644 --- a/documentation.md +++ b/documentation.md @@ -146,6 +146,10 @@ `(time)` returns timestamp in milliseconds +`(animate)` start animation + +`(animate false)` stop animation + ## Javascript interop `js` diff --git a/examples/animate.lisp b/examples/animate.lisp index fa12b3c..b43d696 100644 --- a/examples/animate.lisp +++ b/examples/animate.lisp @@ -1,13 +1,12 @@ ; animate ( - (def start (get ronin "animate")) - (def t (sin (div (time) 100))) (def pos (add 200 (mul 30 t))) (defn square (a) (rect a a a a)) (stroke (square pos) 1 "red") - (start) + (animate) + ;(animate false) to stop animation ) \ No newline at end of file