Skip to content

Commit

Permalink
Fix animation rounding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Oct 5, 2014
1 parent 2a0439a commit fbde7a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion framer/Animators/BezierCurveAnimator.coffee
Expand Up @@ -29,6 +29,9 @@ class exports.BezierCurveAnimator extends Animator
@options = Utils.setDefaultProperties options,
values: BezierCurveDefaults["ease-in-out"]
time: 1
precision: 1/1000

console.log "values", @options.values

@_unitBezier = new UnitBezier \
@options.values[0],
Expand All @@ -49,7 +52,7 @@ class exports.BezierCurveAnimator extends Animator
@_unitBezier.solve @_time / @options.time

finished: ->
@_time >= @options.time
@_time >= @options.time - @options.precision


# WebKit implementation found on http://stackoverflow.com/a/11697909
Expand Down
3 changes: 2 additions & 1 deletion framer/Animators/LinearAnimator.coffee
Expand Up @@ -8,6 +8,7 @@ class exports.LinearAnimator extends Animator

@options = Utils.setDefaultProperties options,
time: 1
precision: 1/1000

@_time = 0

Expand All @@ -20,4 +21,4 @@ class exports.LinearAnimator extends Animator
@_time / @options.time

finished: ->
@_time >= @options.time
@_time >= @options.time - @options.precision

0 comments on commit fbde7a8

Please sign in to comment.