Skip to content

Commit

Permalink
Add function to pre calculate all animator values
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Jun 1, 2016
1 parent 5cc7331 commit c48360d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
37 changes: 14 additions & 23 deletions extras/Studio.framer/app.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)

9 changes: 4 additions & 5 deletions extras/Studio.framer/framer/config.json
Expand Up @@ -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
}
9 changes: 9 additions & 0 deletions framer/Animator.coffee
Expand Up @@ -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.