Permalink
Browse files

Move creation of animator to seperate function

  • Loading branch information...
nvh committed Aug 17, 2016
1 parent f8e4c6b commit afbff064166333f29b841f30f4b297300d9aa094
Showing with 9 additions and 7 deletions.
  1. +9 −7 framer/Animation.coffee
View
@@ -69,13 +69,7 @@ class exports.Animation extends BaseClass
if @layer is null
console.error "Animation: missing layer"
- AnimatorClass = @_animatorClass()
-
- if @options.debug
- console.log "Animation.start #{AnimatorClass.name}", @options.curveOptions
-
- @_animator = new AnimatorClass @options.curveOptions
-
+ @_animator = @_createAnimator()
@_target = @layer
@_stateA = @_currentState()
@_stateB = {}
@@ -236,6 +230,14 @@ class exports.Animation extends BaseClass
_currentState: ->
return _.pick(@layer, _.keys(@properties))
+ _createAnimator: ->
+ AnimatorClass = @_animatorClass()
+
+ if @options.debug
+ console.log "Animation.start #{AnimatorClass.name}", @options.curveOptions
+
+ return new AnimatorClass @options.curveOptions
+
_animatorClass: ->
parsedCurve = Utils.parseFunction(@options.curve)

0 comments on commit afbff06

Please sign in to comment.