Permalink
Browse files

Make curve function work with Framer.Defaults

  • Loading branch information...
nvh committed Feb 17, 2017
1 parent 6d8bc7e commit 9d08997c136f43a16e56747815f9bc45da59b38e
Showing with 19 additions and 1 deletion.
  1. +5 −1 framer/Defaults.coffee
  2. +14 −0 test/tests/LayerAnimationTest.coffee
View
@@ -103,7 +103,11 @@ exports.Defaults =
defaults = _.cloneDeep Originals[className]
# Copy over the user defined options
for k, v of Framer.Defaults[className]
defaults[k] = if _.isFunction(v) then v() else v
# Make an exception for curve functions
if _.isFunction(v) and not (className is "Animation" and k is "curve")
defaults[k] = v()
else
defaults[k] = v
# Then copy over the default keys to the options
for k, v of defaults
@@ -19,6 +19,20 @@ describe "LayerAnimation", ->
Framer.resetDefaults()
it "should handle default spring curves correctly", ->
Framer.Defaults.Animation =
curve: Spring(0.5)
layer = new Layer
animation = layer.animate
x: 50
animation._animator.constructor.name.should.equal "SpringRK4Animator"
Framer.resetDefaults()
it "should use linear", ->
# We shouldn't change the linear default, people rely on it

0 comments on commit 9d08997

Please sign in to comment.