Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@f/animate

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@f/animate - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

36

lib/index.js

@@ -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++
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc