Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,3 @@ /** | ||
var elapsed = require('@f/elapsed-time') | ||
var tween = require('@f/tween') | ||
@@ -10,2 +11,8 @@ var raf = require('@f/raf') | ||
/** | ||
* Constants | ||
*/ | ||
var fps60 = 1000 / 60 | ||
/** | ||
* Expose animate | ||
@@ -20,19 +27,18 @@ */ | ||
function animate (start, end, render, duration, easing) { | ||
var tick = tween(start, end, duration, easing) | ||
var t = 0 | ||
function animate (start, end, render, duration, easing) { | ||
var tick = tween(start, end, duration, easing, fps60) | ||
var time = elapsed() | ||
var id = raf(function ticker () { | ||
var frame = tick(t) | ||
render(frame, t) | ||
var id = raf(function ticker () { | ||
var frame = tick(time() / fps60) | ||
render(frame) | ||
if (frame !== end) { | ||
t++ | ||
id = raf(ticker) | ||
} | ||
}) | ||
if (frame !== end) { | ||
id = raf(ticker) | ||
} | ||
}) | ||
return function () { | ||
raf.cancel(id) | ||
} | ||
} | ||
return function () { | ||
raf.cancel(id) | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/micro-js/animate.git", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -13,2 +13,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@f/elapsed-time": "^1.0.0", | ||
"@f/raf": "^1.0.0", | ||
@@ -15,0 +16,0 @@ "@f/tween": "^1.0.0" |
@@ -15,8 +15,11 @@ /** | ||
animate({width: 10}, {width: 100}, function (frame, tick) { | ||
if (tick === 0) { | ||
t.deepEqual(frame, {width: 10}) | ||
var n = 0 | ||
animate({width: 10}, {width: 100}, function (frame) { | ||
if (n === 0) { | ||
t.ok(frame.width <= 11) | ||
t.end() | ||
} | ||
n++ | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3481
50
3
+ Added@f/elapsed-time@^1.0.0
+ Added@f/elapsed-time@1.0.0(transitive)
+ Added@f/timestamp@1.0.0(transitive)