From c48360dcd428a7ce51958c8ba72be7d9090ddc56 Mon Sep 17 00:00:00 2001 From: Koen Bok Date: Wed, 1 Jun 2016 14:40:00 +0200 Subject: [PATCH] Add function to pre calculate all animator values --- extras/Studio.framer/app.coffee | 37 ++++++++++--------------- extras/Studio.framer/framer/config.json | 9 +++--- framer/Animator.coffee | 9 ++++++ 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/extras/Studio.framer/app.coffee b/extras/Studio.framer/app.coffee index 3f276b17b..f6666585f 100644 --- a/extras/Studio.framer/app.coffee +++ b/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) - diff --git a/extras/Studio.framer/framer/config.json b/extras/Studio.framer/framer/config.json index 6aae77794..010bec774 100644 --- a/extras/Studio.framer/framer/config.json +++ b/extras/Studio.framer/framer/config.json @@ -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 } \ No newline at end of file diff --git a/framer/Animator.coffee b/framer/Animator.coffee index 4522cfbee..7e89302a5 100644 --- a/framer/Animator.coffee +++ b/framer/Animator.coffee @@ -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 @