Permalink
Browse files

Move checking of colorProperty to Color class

  • Loading branch information...
nvh committed Jul 22, 2016
1 parent a7367a7 commit 486424100d17f65e834f404b55813546807cc6da
Showing with 10 additions and 3 deletions.
  1. +2 −3 framer/Animation.coffee
  2. +8 −0 framer/Color.coffee
View
@@ -304,9 +304,8 @@ class exports.Animation extends BaseClass
for k, v of properties
if _.isNumber(v) or _.isFunction(v) or isRelativeProperty(v) or Color.isColorObject(v) or v == null
animatableProperties[k] = v
else if _.isString(v)
if Color.isColorString(v)
animatableProperties[k] = new Color(v)
else if Color.isValidColorProperty(k,v)
animatableProperties[k] = new Color(v)
return animatableProperties
View
@@ -282,6 +282,14 @@ class exports.Color extends BaseClass
return stringToObject(colorString) != false
return false
@isValidColorProperty: (name, value) ->
# We check if the property name ends with color, because we don't want
# to convert every string that looks like a Color, like the html property containing "add"
if _.endsWith(name.toLowerCase(), "color") and _.isString(value) and Color.isColorString(value)
return true
return false
@equal: (colorA, colorB) ->
if !@validColorValue(colorA)

0 comments on commit 4864241

Please sign in to comment.