Fixed animate example

This commit is contained in:
Devine Lu Linvega 2019-07-17 11:17:27 +09:00
parent 1a7b1c53d7
commit 06bfca5828
4 changed files with 10 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -46,7 +46,7 @@
ronin.controller.add("default","View","Toggle Commander",() => { ronin.commander.toggle(); },"CmdOrCtrl+K");
ronin.controller.add("default","Project","Run",() => { ronin.commander.run(); },"CmdOrCtrl+R");
ronin.controller.add("default","Project","Reload Run",() => { ronin.source.revert(); ronin.commander.run(); },"CmdOrCtrl+Shift+R");
ronin.controller.add("default","Project", "Toggle Animation (experimental)",() => { ronin.animate(!ronin.always); },"CmdOrCtrl+Shift+T");
ronin.controller.add("default","Project", "Animate",() => { ronin.animate(!ronin.always); },"CmdOrCtrl+Shift+T");
ronin.controller.add("default","Theme","Open Theme",() => { ronin.theme.open() },"CmdOrCtrl+Shift+O")
ronin.controller.add("default","Theme","Reset Theme",() => { ronin.theme.reset() },"CmdOrCtrl+Shift+Backspace")
ronin.controller.addSpacer('default', 'Theme', 'Download')

View File

@ -61,6 +61,7 @@ function Ronin () {
}
this.animate = (b = true) => {
if(this.always === b){ return }
this.always = b
this.commander.run()
}

View File

@ -1,10 +1,13 @@
; animate
(
(ronin animate)
(def t (sin (div (time) 100)))
(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")
(def pos (add 200 (mul 30 t)))
(defn square (a) (rect a a a a))
(stroke (square pos) 1 "red")
(start)
)