@cheprasov/web-animation
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -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: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}()}]); | ||
module.exports=function(t){var n={};function i(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=n,i.d=function(t,n,e){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,n){if(1&n&&(t=i(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)i.d(e,o,function(n){return t[n]}.bind(null,o));return e},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=0)}([function(t,n,i){"use strict";function e(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function o(t,n,i){return n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}i.r(n),i.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),o(this,"_isInLoop",!1);var i=function(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{},e=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(i).filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable}))),e.forEach(function(n){o(t,n,i[n])})}return t}({},r,n);this._duration=i.duration,this._rAF=i.rAF||window.requestAnimationFrame.bind(window),this._easing=i.easing,this._onStep=i.onStep,this._onStop=i.onStop,this._onFinish=i.onFinish,this._onTick=this._onTick.bind(this)}var n,i,s;return n=t,(i=[{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._isInLoop||(this._rAF(this._onTick),this._isInLoop=!0)}},{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,i=Math.min(1,t/this._duration);return{elapsedTime:t,ratio:i,tween:this._easing(i),isFinished:n}}},{key:"_onTick",value:function(){if(this._isStopped)this._isInLoop=!1;else{var t=this.getProgress();if(this._onStep&&this._onStep(t,this),t.isFinished)return this._isStopped=!0,this._onFinish&&this._onFinish(t,this),void(this._isInLoop=!1);this._rAF(this._onTick)}}}])&&e(n.prototype,i),s&&e(n,s),t}()}]); |
{ | ||
"name": "@cheprasov/web-animation", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"author": "Alexander Cheprasov", | ||
@@ -5,0 +5,0 @@ "description": "A Class for driving animated content on the web is based on requestAnimationFrame for performance.", |
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
27981