Permalink
Browse files

Add function to pre calculate all animator values

  • Loading branch information...
koenbok committed Jun 1, 2016
1 parent 5cc7331 commit c48360dcd428a7ce51958c8ba72be7d9090ddc56
Showing with 27 additions and 28 deletions.
  1. +14 −23 extras/Studio.framer/app.coffee
  2. +4 −5 extras/Studio.framer/framer/config.json
  3. +9 −0 framer/Animator.coffee
@@ -1,28 +1,19 @@
if not Utils.isFramerStudio()
Framer.Extras.Preloader.enable()
Framer.Extras.Hints.enable()
rk4 = new Framer.SpringRK4Animator
friction: 5
tension: 90
nav = new NavComponent
values = rk4.values(1/60*2)
grid = new GridComponent
width: Screen.width * 2
height: Screen.height * 2
rows: 10
columns: 10
# Draw a stupid graph
nav.push(grid)
graph = new Layer
point: Align.center
grid.renderCell = (layer) ->
layer.image = Utils.randomImage(layer) + "?date=#{Date.now()}"
layer.onClick ->
large = new Layer
size: Utils.frameInset(nav, 80)
image: @image
large.onTap ->
nav.back()
for index, value of values
new Layer
parent: graph
size: 6
borderRadius: 6
x: parseInt(index) * (graph.width / values.length)
y: value * (graph.height / 2)
nav.modal(large)
@@ -5,13 +5,12 @@
"deviceOrientation" : 0,
"sharedPrototype" : 1,
"contentScale" : 1,
"deviceType" : "apple-iphone-6s-gold",
"deviceType" : "fullscreen",
"selectedHand" : "",
"updateDelay" : 0.3,
"deviceScale" : "fit",
"deviceScale" : 1,
"codeFolds" : [
"{91, 233}"
],
"orientation" : 0,
"fullScreen" : false
"orientation" : 0
}
View
@@ -22,6 +22,15 @@ class exports.Animator
finished: ->
throw Error "Not implemented"
values: (delta=1/60)->
values = []
while not @finished()
values.push(@next(delta))
return values
# start: -> Framer.Loop.on("update", )
# stop: -> AnimationLoop.remove @

0 comments on commit c48360d

Please sign in to comment.