Permalink
Browse files

Animatable linear gradients

  • Loading branch information...
jonastreub committed Jun 12, 2017
1 parent 289e98b commit cc7d5b14becdef678688693ff6cfe35d7a90c5a2
Showing with 6 additions and 1 deletion.
  1. +6 −1 framer/Animation.coffee
View
@@ -278,6 +278,8 @@ class exports.Animation extends BaseClass
for k, v of @_stateB
if Color.isColorObject(v) or Color.isColorObject(@_stateA[k])
@_valueUpdaters[k] = @_updateColorValue
else if LinearGradient.isLinearGradient(v)
@_valueUpdaters[k] = @_updateGradientValue
else
@_valueUpdaters[k] = @_updateNumberValue
@@ -291,11 +293,14 @@ class exports.Animation extends BaseClass
_updateColorValue: (key, value) =>
@_target[key] = Color.mix(@_stateA[key], @_stateB[key], value, false, @options.colorModel)
_updateGradientValue: (key, value) =>
@_target[key] = LinearGradient.mix(@_stateA[key], @_stateB[key], value)
_currentState: ->
return _.pick(@layer, _.keys(@properties))
@isAnimatable = (v) ->
_.isNumber(v) or _.isFunction(v) or isRelativeProperty(v) or Color.isColorObject(v)
_.isNumber(v) or _.isFunction(v) or isRelativeProperty(v) or Color.isColorObject(v) or LinearGradient.isLinearGradient(v)
@filterAnimatableProperties = (properties) ->
# Function to filter only animatable properties out of a given set

0 comments on commit cc7d5b1

Please sign in to comment.