Permalink
Browse files

Merge pull request #459 from koenbok/fix/slider-broken-anims

Fix/slider broken anims
  • Loading branch information...
onnlucky committed Jan 2, 2017
2 parents 3821f65 + b49ca3e commit f3a1c68a37f009b4e0dc2eeafabe91b636e37483
Showing with 6 additions and 4 deletions.
  1. +2 −2 framer/AnimationLoop.coffee
  2. +4 −2 framer/Components/SliderComponent.coffee
@@ -56,12 +56,12 @@ class exports.AnimationLoop extends EventEmitter
tick = (timestamp) ->
if animationLoop.raf
- update()
window.requestAnimationFrame(tick)
+ update()
else
window.setTimeout ->
- update()
window.requestAnimationFrame(tick)
+ update()
, 0
tick()
@@ -184,15 +184,16 @@ class exports.SliderComponent extends Layer
@define "min",
get: -> @_min or 0
- set: (value) -> @_min = value
+ set: (value) -> @_min = value if _.isFinite(value)
@define "max",
get: -> @_max or 1
- set: (value) -> @_max = value
+ set: (value) -> @_max = value if _.isFinite(value)
@define "value",
get: -> return @_value
set: (value) ->
+ return unless _.isFinite(value)
@_value = Utils.clamp(value, @min, @max)
@@ -244,6 +245,7 @@ class exports.SliderComponent extends Layer
return Utils.modulate(value, [0, @height], [@min, @max], true)
animateToValue: (value, animationOptions={curve: "spring(300, 25, 0)"}) ->
+ return unless _.isFinite(value)
if @width > @height
animationOptions.properties = {x: @pointForValue(value) - (@knob.width/2)}
else

0 comments on commit f3a1c68

Please sign in to comment.