add (animate)
This commit is contained in:
parent
77eb301d3e
commit
521ece7937
@ -1,4 +1,5 @@
|
|||||||
function Library (ronin) {
|
function Library (ronin) {
|
||||||
|
console.log(ronin)
|
||||||
this.open = async (path) => {
|
this.open = async (path) => {
|
||||||
return ronin.surface.open(path)
|
return ronin.surface.open(path)
|
||||||
}
|
}
|
||||||
@ -326,12 +327,15 @@ function Library (ronin) {
|
|||||||
return a === b
|
return a === b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client
|
||||||
|
this.ronin = ronin
|
||||||
|
|
||||||
// Livecoding
|
// Livecoding
|
||||||
this.time = Date.now
|
this.time = Date.now
|
||||||
|
|
||||||
|
this.animate = (b = true) => ronin.animate(b)
|
||||||
|
|
||||||
// javascript interop
|
// javascript interop
|
||||||
this.js = window
|
this.js = window
|
||||||
|
|
||||||
// Client
|
|
||||||
this.ronin = ronin
|
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,10 @@
|
|||||||
|
|
||||||
`(time)` returns timestamp in milliseconds
|
`(time)` returns timestamp in milliseconds
|
||||||
|
|
||||||
|
`(animate)` start animation
|
||||||
|
|
||||||
|
`(animate false)` stop animation
|
||||||
|
|
||||||
## Javascript interop
|
## Javascript interop
|
||||||
|
|
||||||
`js`
|
`js`
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
; animate
|
; animate
|
||||||
|
|
||||||
(
|
(
|
||||||
(def start (get ronin "animate"))
|
|
||||||
|
|
||||||
(def t (sin (div (time) 100)))
|
(def t (sin (div (time) 100)))
|
||||||
|
|
||||||
(def pos (add 200 (mul 30 t)))
|
(def pos (add 200 (mul 30 t)))
|
||||||
(defn square (a) (rect a a a a))
|
(defn square (a) (rect a a a a))
|
||||||
(stroke (square pos) 1 "red")
|
(stroke (square pos) 1 "red")
|
||||||
|
|
||||||
(start)
|
(animate)
|
||||||
|
;(animate false) to stop animation
|
||||||
)
|
)
|
Loading…
x
Reference in New Issue
Block a user