Skip to content

Commit

Permalink
Merge pull request #459 from koenbok/fix/slider-broken-anims
Browse files Browse the repository at this point in the history
Fix/slider broken anims
  • Loading branch information
onnlucky committed Jan 2, 2017
2 parents 3821f65 + b49ca3e commit f3a1c68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions framer/AnimationLoop.coffee
Expand Up @@ -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()
6 changes: 4 additions & 2 deletions framer/Components/SliderComponent.coffee
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f3a1c68

Please sign in to comment.