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

@cheprasov/web-animation

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cheprasov/web-animation - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

2

dist/web-animation.js

@@ -1,1 +0,1 @@

module.exports=function(t){var n={};function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(n){return t[n]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";function i(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}e.r(n),e.d(n,"default",function(){return s});var r={duration:1e3,easing:function(t){return t},rAF:null,onStep:null,onStop:null,onFinish:null},s=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,"_duration",void 0),o(this,"_startTime",0),o(this,"_isStopped",!0),o(this,"_easing",void 0),o(this,"_rAF",void 0),o(this,"_onStop",void 0),o(this,"_onStep",void 0),o(this,"_onFinish",void 0);var e=function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{},i=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(n){o(t,n,e[n])})}return t}({},r,n);this._duration=e.duration,this._rAF=e.rAF||window.requestAnimationFrame.bind(window),this._easing=e.easing,this._onStep=e.onStep,this._onStop=e.onStop,this._onFinish=e.onFinish,this._onTick=this._onTick.bind(this)}var n,e,s;return n=t,(e=[{key:"setOnStop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onStop=t}},{key:"setOnStep",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onStep=t}},{key:"setOnFinish",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onFinish=t}},{key:"stop",value:function(){if(!this._isStopped&&(this._isStopped=!0,this._onStop)){var t=this.getProgress();this._onStop(t,this)}}},{key:"run",value:function(){this._isStopped=!1,this._startTime=Date.now(),this._rAF(this._onTick)}},{key:"getProgress",value:function(){if(!this._duration||this._duration<=0)return{elapsedTime:0,ratio:1,tween:1,isFinished:!0};var t=Date.now()-this._startTime,n=t>=this._duration,e=Math.min(1,t/this._duration);return{elapsedTime:t,ratio:e,tween:this._easing(e),isFinished:n}}},{key:"_onTick",value:function(){if(!this._isStopped){var t=this.getProgress();if(this._onStep&&this._onStep(t,this),t.isFinished)return this._isStopped=!0,void(this._onFinish&&this._onFinish(t,this));this._rAF(this._onTick)}}}])&&i(n.prototype,e),s&&i(n,s),t}()}]);
module.exports=function(t){var n={};function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(n){return t[n]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";function i(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}e.r(n),e.d(n,"default",function(){return s});var r={duration:1e3,easing:function(t){return t},rAF:null,onStep:null,onStop:null,onFinish:null},s=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,"_duration",void 0),o(this,"_startTime",0),o(this,"_isStopped",!0),o(this,"_easing",void 0),o(this,"_rAF",void 0),o(this,"_onStop",void 0),o(this,"_onStep",void 0),o(this,"_onFinish",void 0);var e=function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{},i=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(n){o(t,n,e[n])})}return t}({},r,n);this._duration=e.duration,this._rAF=e.rAF||window.requestAnimationFrame.bind(window),this._easing=e.easing,this._onStep=e.onStep,this._onStop=e.onStop,this._onFinish=e.onFinish,this._onTick=this._onTick.bind(this)}var n,e,s;return n=t,(e=[{key:"setOnStop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onStop=t}},{key:"setOnStep",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onStep=t}},{key:"setOnFinish",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this._onFinish=t}},{key:"stop",value:function(){if(!this._isStopped&&(this._isStopped=!0,this._onStop)){var t=this.getProgress();this._onStop(t,this)}}},{key:"run",value:function(){this._isStopped=!1,this._startTime=Date.now(),this._rAF(this._onTick)}},{key:"getProgress",value:function(){if(!this._duration||this._duration<=0)return{elapsedTime:0,ratio:1,tween:this._easing(1),isFinished:!0};var t=Date.now()-this._startTime,n=t>=this._duration,e=Math.min(1,t/this._duration);return{elapsedTime:t,ratio:e,tween:this._easing(e),isFinished:n}}},{key:"_onTick",value:function(){if(!this._isStopped){var t=this.getProgress();if(this._onStep&&this._onStep(t,this),t.isFinished)return this._isStopped=!0,void(this._onFinish&&this._onFinish(t,this));this._rAF(this._onTick)}}}])&&i(n.prototype,e),s&&i(n,s),t}()}]);
{
"name": "@cheprasov/web-animation",
"version": "0.1.4",
"version": "0.1.5",
"author": "Alexander Cheprasov",

@@ -5,0 +5,0 @@ "description": "A Class for driving animated content on the web is based on requestAnimationFrame for performance.",

@@ -85,3 +85,3 @@ //@flow

if (!this._duration || this._duration <= 0) {
return { elapsedTime: 0, ratio: 1, tween: 1, isFinished: true };
return { elapsedTime: 0, ratio: 1, tween: this._easing(1), isFinished: true };
}

@@ -88,0 +88,0 @@ const elapsedTime = Date.now() - this._startTime;

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