add (animate)
This commit is contained in:
parent
77eb301d3e
commit
521ece7937
@ -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
|
||||
}
|
||||
|
@ -146,6 +146,10 @@
|
||||
|
||||
`(time)` returns timestamp in milliseconds
|
||||
|
||||
`(animate)` start animation
|
||||
|
||||
`(animate false)` stop animation
|
||||
|
||||
## Javascript interop
|
||||
|
||||
`js`
|
||||
|
@ -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
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user