New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

animation

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animation - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

34

lib/animation.js

@@ -15,14 +15,2 @@ (function() {

requestAnimationFrame = (function() {
var orig;
orig = requestAnimationFrame;
return function(callback, timeout) {
if (orig.isNative) {
return orig(callback);
} else {
return orig(callback, timeout);
}
};
})();
this.Animation = (function() {

@@ -33,9 +21,10 @@

function Animation(opts) {
var _ref2, _ref3;
var _ref2, _ref3, _ref4;
if (opts == null) opts = {};
this.nextTick = __bind(this.nextTick, this);
this.executiontime = ms((_ref2 = opts.execution) != null ? _ref2 : 5);
this.timoutexecutiontime = ms((_ref2 = opts.timeoutexecution) != null ? _ref2 : 20);
this.executiontime = ms((_ref3 = opts.execution) != null ? _ref3 : 5);
this.timeouttime = opts.timeout;
if (this.timeouttime != null) this.timeouttime = ms(this.timeouttime);
this.autotoggle = (_ref3 = opts.toggle) != null ? _ref3 : false;
this.autotoggle = (_ref4 = opts.toggle) != null ? _ref4 : false;
this.frametime = opts.frame;

@@ -49,7 +38,7 @@ if (this.frametime != null) this.frametime = ms(this.frametime);

Animation.prototype.work_queue = function(started, dt) {
Animation.prototype.work_queue = function(started, dt, executiontime) {
var t, _base, _results;
t = now();
_results = [];
while (this.queue.length && t - started < this.executiontime) {
while (this.queue.length && t - started < executiontime) {
if (typeof (_base = this.queue.shift()) === "function") _base();

@@ -72,6 +61,11 @@ _results.push(t = now());

tick = function(success) {
var dt, started;
var dt, executiontime, started;
started = now();
dt = started - t;
if (success) {
executiontime = this.executiontime;
} else {
executiontime = this.timoutexecutiontime;
}
if (success) {
clearTimeout(timeout);

@@ -83,3 +77,3 @@ } else {

if (typeof callback === "function") callback(dt);
this.work_queue(started, dt);
this.work_queue(started, dt, executiontime);
if (this.running && !this.paused) {

@@ -109,3 +103,3 @@ if (this.queue.length) {

request = requestAnimationFrame(frame, this.frametime);
if (this.timeoutime != null) {
if (this.timeouttime != null) {
return timeout = setTimeout(tick.bind(this, false), this.timeouttime);

@@ -112,0 +106,0 @@ }

{ "name": "animation"
, "description": "animation timing & handling"
, "version": "0.0.1"
, "version": "0.0.2"
, "homepage": "https://github.com/dodo/node-animation"

@@ -5,0 +5,0 @@ , "author": "dodo (https://github.com/dodo)"

@@ -28,4 +28,5 @@ # [animation](https://github.com/dodo/node-animation/)

// defaults
timeoutexecution:'20ms', // allowed execution time per animation tick timeout
execution: '5ms', // allowed execution time per animation tick
timeout: null, // maximum time of a animation tick interval
timeout: null, // maximum time of a animation tick interval else runs continuously if null
toggle: false, // if true animation pauses and resumes itself when render queue gets empty or filled

@@ -32,0 +33,0 @@ frame: '16ms' // time per frame

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