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

tina

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tina - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

14

build/tina.min.js

@@ -5,3 +5,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

},{"./Transition":15,"./TransitionRelative":16,"./easing":19,"./interpolation":22}],2:[function(require,module,exports){
function BriefExtension(){this._duration=0,this._onComplete=null,this._iterations=1,this._persist=!1,this._pingpong=!1}module.exports=BriefExtension,BriefExtension.prototype.onComplete=function(t){return this._onComplete=t,this},BriefExtension.prototype.getDuration=function(){return this._duration*this._iterations/this._speed},BriefExtension.prototype.goToEnd=function(){return this.goTo(this.getDuration(),this._iterations-1),this},BriefExtension.prototype.loop=function(){return this.iterations(1/0)},BriefExtension.prototype.iterations=function(t){return 0>t?(console.warn("[BriefExtension.iterations] Number of iterations cannot be negative"),this):(this._iterations=t,null!==this._player&&this._player._onPlayableChanged(this),this)},BriefExtension.prototype.persist=function(t){return this._persist=t,null!==this._player&&this._player._onPlayableChanged(this),this},BriefExtension.prototype.pingpong=function(t){return this._pingpong=t,null!==this._player&&this._player._onPlayableChanged(this),this},BriefExtension.prototype._complete=function(t){return this._persist===!0?(this._startTime+=t,void this._player._onPlayableChanged(this)):this._player._inactivate(this)===!1?this:void(null!==this._onComplete&&this._onComplete(t))},BriefExtension.prototype._moveTo=function(t,i){i*=this._speed;var e;if(0!==i)if(1===this._iterations)this._time=(t-this._startTime)*this._speed,i>0?this._time>=this._duration&&(e=this._time-this._duration,i-=e,this._time=this._duration):0>i&&this._time<=0&&(e=this._time,i-=e,this._time=0);else{t=(t-this._startTime)*this._speed;var s=t/this._duration;i>0?s<this._iterations?this._time=t%this._duration:(e=(s-this._iterations)*this._duration,i-=e,this._time=this._duration*(1-(Math.ceil(this._iterations)-this._iterations))):0>i&&(s>0?this._time=t%this._duration:(e=s*this._duration,i-=e,this._time=0)),this._pingpong===!0&&(Math.ceil(this._iterations)===this._iterations?void 0===e?0===(1&Math.ceil(s))&&(this._time=this._duration-this._time):1===(1&Math.ceil(s))&&(this._time=this._duration-this._time):0===(1&Math.ceil(s))&&(this._time=this._duration-this._time))}this._update(i),null!==this._onUpdate&&this._onUpdate(this._time,i),void 0!==e&&this._complete(e)};
function BriefExtension(){this._duration=0,this._onComplete=null,this._iterations=1,this._pingpong=!1,this._persist=!1}module.exports=BriefExtension,BriefExtension.prototype.onComplete=function(t){return this._onComplete=t,this},BriefExtension.prototype.getDuration=function(){return this._duration*this._iterations/this._speed},BriefExtension.prototype.goToEnd=function(){return this.goTo(this.getDuration(),this._iterations-1),this},BriefExtension.prototype.loop=function(){return this.iterations(1/0)},BriefExtension.prototype.iterations=function(t){return 0>t?(console.warn("[BriefExtension.iterations] Number of iterations cannot be negative"),this):(this._iterations=t,null!==this._player&&this._player._onPlayableChanged(this),this)},BriefExtension.prototype.persist=function(t){return this._persist=t,null!==this._player&&this._player._onPlayableChanged(this),this},BriefExtension.prototype.pingpong=function(t){return this._pingpong=t,null!==this._player&&this._player._onPlayableChanged(this),this},BriefExtension.prototype._complete=function(t){return this._persist===!0?(this._startTime+=t,void this._player._onPlayableChanged(this)):this._player._inactivate(this)===!1?this:void(null!==this._onComplete&&this._onComplete(t))},BriefExtension.prototype._moveTo=function(t,i){i*=this._speed;var e;if(0!==i)if(1===this._iterations)this._time=(t-this._startTime)*this._speed,i>0?this._time>=this._duration&&(e=this._time-this._duration,i-=e,this._time=this._duration):0>i&&this._time<=0&&(e=this._time,i-=e,this._time=0);else{t=(t-this._startTime)*this._speed;var s=t/this._duration;i>0?s<this._iterations?this._time=t%this._duration:(e=(s-this._iterations)*this._duration,i-=e,this._time=this._duration*(1-(Math.ceil(this._iterations)-this._iterations))):0>i&&(s>0?this._time=t%this._duration:(e=s*this._duration,i-=e,this._time=0)),this._pingpong===!0&&(Math.ceil(this._iterations)===this._iterations?void 0===e?0===(1&Math.ceil(s))&&(this._time=this._duration-this._time):1===(1&Math.ceil(s))&&(this._time=this._duration-this._time):0===(1&Math.ceil(s))&&(this._time=this._duration-this._time))}this._update(i),null!==this._onUpdate&&this._onUpdate(this._time,i),void 0!==e&&this._complete(e)};

@@ -24,6 +24,6 @@ },{}],3:[function(require,module,exports){

},{"./AbstractTween":1,"./BriefPlayable":3}],8:[function(require,module,exports){
function Playable(){this._player=null,this._handle=null,this._startTime=0,this._time=0,this._speed=1,this._onStart=null,this._onPause=null,this._onResume=null,this._onUpdate=null,this._onStop=null}module.exports=Playable,Object.defineProperty(Playable.prototype,"speed",{get:function(){return this._speed},set:function(t){0===t?0!==this._speed&&(this._startTime+=this._time/this._speed-this._time):0===this._speed?this._startTime+=this._time-this._time/t:this._startTime+=this._time/this._speed-this._time/t,this._speed=t,null!==this._player&&this._player._onPlayableChanged(this)}}),Object.defineProperty(Playable.prototype,"time",{get:function(){return this._time},set:function(t){this.goTo(t)}}),Playable.prototype.onStart=function(t){return this._onStart=t,this},Playable.prototype.onUpdate=function(t){return this._onUpdate=t,this},Playable.prototype.onStop=function(t){return this._onStop=t,this},Playable.prototype.onPause=function(t){return this._onPause=t,this},Playable.prototype.onResume=function(t){return this._onResume=t,this},Playable.prototype.tweener=function(t){return null===t||void 0===t?(console.warn("[Playable.tweener] Given tweener is invalid:",t),this):(this._player=t,this)},Playable.prototype.goTo=function(t,e){return 1===this._iterations?0===this._speed?this._startTime+=this._time-t:this._startTime+=(this._time-t)/this._speed:(e=e||0,0===this._speed?this._startTime+=this._time-t-e*this._duration:this._startTime+=(this._time-t-e*this._duration)/this._speed),this._time=t,null!==this._player&&this._player._onPlayableChanged(this),this},Playable.prototype.rewind=function(){return this.goTo(0,0),this},Playable.prototype.delay=function(t){return this.start(-t)},Playable.prototype.start=function(t){return null===this._player&&(this._player=TINA._getDefaultTweener()),this._validate()===!1?this:this._player._add(this)===!1?this:((void 0===t||null===t)&&(t=0),this._startTime=this._player._time-t,this)},Playable.prototype._start=function(t){null!==this._onStart&&this._onStart()},Playable.prototype.stop=function(){return this._player._inactivate(this)===!1?this:(null!==this._onStop&&this._onStop(),this)},Playable.prototype.resume=function(){return this._player._activate(this)===!1?this:(null!==this._onResume&&this._onResume(),this)},Playable.prototype.pause=function(){return this._player._inactivate(this)===!1?this:(null!==this._onPause&&this._onPause(),this)},Playable.prototype._moveTo=function(t,e){e*=this._speed,this._time=(t-this._startTime)*this._speed,this._update(e),null!==this._onUpdate&&this._onUpdate(this._time,e)},Playable.prototype._update=function(){},Playable.prototype._validate=function(){};
function Playable(){this._player=null,this._handle=null,this._startTime=0,this._time=0,this._speed=1,this._onStart=null,this._onPause=null,this._onResume=null,this._onUpdate=null,this._onStop=null}module.exports=Playable,Object.defineProperty(Playable.prototype,"speed",{get:function(){return this._speed},set:function(t){0===t?0!==this._speed&&(this._startTime+=this._time/this._speed-this._time):0===this._speed?this._startTime+=this._time-this._time/t:this._startTime+=this._time/this._speed-this._time/t,this._speed=t,null!==this._player&&this._player._onPlayableChanged(this)}}),Object.defineProperty(Playable.prototype,"time",{get:function(){return this._time},set:function(t){this.goTo(t)}}),Playable.prototype.onStart=function(t){return this._onStart=t,this},Playable.prototype.onUpdate=function(t){return this._onUpdate=t,this},Playable.prototype.onStop=function(t){return this._onStop=t,this},Playable.prototype.onPause=function(t){return this._onPause=t,this},Playable.prototype.onResume=function(t){return this._onResume=t,this},Playable.prototype.tweener=function(t){return null===t||void 0===t?(console.warn("[Playable.tweener] Given tweener is invalid:",t),this):(this._player=t,this)},Playable.prototype.goTo=function(t,e){return 1===this._iterations?0===this._speed?this._startTime+=this._time-t:this._startTime+=(this._time-t)/this._speed:(e=e||0,0===this._speed?this._startTime+=this._time-t-e*this._duration:this._startTime+=(this._time-t-e*this._duration)/this._speed),this._time=t,null!==this._player&&this._player._onPlayableChanged(this),this},Playable.prototype.rewind=function(){return this.goTo(0,0),this},Playable.prototype.delay=function(t){return this.start(-t)},Playable.prototype.start=function(t){return null===this._player&&(this._player=TINA._getDefaultTweener()),this._validate()===!1?this:this._player._add(this)===!1?this:((void 0===t||null===t)&&(t=0),this._startTime=this._player._time-t,this)},Playable.prototype._start=function(){null!==this._onStart&&this._onStart()},Playable.prototype.stop=function(){return this._player._inactivate(this)===!1?this:(null!==this._onStop&&this._onStop(),this)},Playable.prototype.resume=function(){return this._player._activate(this)===!1?this:(null!==this._onResume&&this._onResume(),this)},Playable.prototype.pause=function(){return this._player._inactivate(this)===!1?this:(null!==this._onPause&&this._onPause(),this)},Playable.prototype._moveTo=function(t,e){e*=this._speed,this._time=(t-this._startTime)*this._speed,this._update(e),null!==this._onUpdate&&this._onUpdate(this._time,e)},Playable.prototype._update=function(){},Playable.prototype._validate=function(){};
},{}],9:[function(require,module,exports){
function Player(){Playable.call(this),this._activePlayables=new DoublyList,this._inactivePlayables=new DoublyList,this._playablesToRemove=new DoublyList,this._silent=!1,this._debug=!1}var Playable=require("./Playable"),DoublyList=require("./DoublyList");Player.prototype=Object.create(Playable.prototype),Player.prototype.constructor=Player,module.exports=Player,Player.prototype._add=function(e,a){return null===e._handle?(e._handle=this._inactivePlayables.add(e),e._player=this,!0):e._handle.container===this._playablesToRemove?(e._handle=this._playablesToRemove.removeByReference(e._handle),!0):e._handle.container===this._activePlayables?(this._warn("[Player._add] Playable is already present, and active"),!1):e._handle.container===this._inactivePlayables?(this._warn("[Player._add] Playable is already present, but inactive (could be starting)"),!1):(this._warn("[Player._add] Playable is used elsewhere"),!1)},Player.prototype._remove=function(e){return null===e._handle?(this._warn("[Player._remove] Playable is not being used"),!1):e._handle.container===this._activePlayables?(e._handle=this._playablesToRemove.add(e._handle),!0):e._handle.container===this._inactivePlayables?(e._handle=this._inactivePlayables.removeByReference(e._handle),!0):e._handle.container===this._playablesToRemove?(this._warn("[Player._remove] Playable is already being removed"),!1):(this._warn("[Player._add] Playable is used elsewhere"),!1)},Player.prototype.remove=function(e){return e._handle.container===this._activePlayables&&e.stop(),e._handle.container!==this._playablesToRemove&&this._remove(e),this._onPlayableRemoved(e),this},Player.prototype.removeAll=function(){for(var e=this._activePlayables.first;null!==e;){var a=e.next;e.object.stop(),e=a}return this._handlePlayablesToRemove(),this._onAllPlayablesRemoved(),this},Player.prototype.possess=function(e){return null===e._handle?!1:e._handle.container===this._activePlayables||e._handle.container===this._inactivePlayables},Player.prototype._handlePlayablesToRemove=function(){for(;this._playablesToRemove.length>0;){var e=this._playablesToRemove.pop(),a=e.object;a._handle=this._activePlayables.removeByReference(e),a._player=null}},Player.prototype.clear=function(){return this._activePlayables.clear(),this._inactivePlayables.clear(),this._playablesToRemove.clear(),this._controls.clear(),this},Player.prototype._warn=function(e){this._silent===!1&&console.warn(e),this._debug===!0},Player.prototype.silent=function(e){return this._silent=e,this},Player.prototype.debug=function(e){return this._debug=e,this},Player.prototype.stop=function(){for(var e=this._activePlayables.first;null!==e;){var a=e.next,t=e.object;t.stop(),e=a}this._handlePlayablesToRemove(),Playable.prototype.stop.call(this)},Player.prototype._activate=function(e){this._inactivePlayables.removeByReference(e._handle),e._handle=this._activePlayables.addBack(e)},Player.prototype._inactivate=function(e){this._activePlayables.removeByReference(e._handle),e._handle=this._inactivePlayables.addBack(e)},Player.prototype._updatePlayableList=function(e){this._handlePlayablesToRemove();for(var a=this._inactivePlayables.first;null!==a;){var t=a.object;a=a.next;var l=t._startTime,i=l+t.getDuration();l<=this._time&&this._time<=i&&(this._inactivePlayables.removeByReference(t._handle),t._handle=this._activePlayables.addBack(t),t._start(this._time-l))}},Player.prototype._update=function(e){this._updatePlayableList(e);for(var a=this._activePlayables.first;null!==a;a=a.next)a.object._moveTo(this._time,e)},Player.prototype._onPlayableChanged=function(){},Player.prototype._onPlayableRemoved=function(){},Player.prototype._onAllPlayablesRemoved=function(){};
function Player(){Playable.call(this),this._activePlayables=new DoublyList,this._inactivePlayables=new DoublyList,this._playablesToRemove=new DoublyList,this._silent=!1,this._debug=!1}var Playable=require("./Playable"),DoublyList=require("./DoublyList");Player.prototype=Object.create(Playable.prototype),Player.prototype.constructor=Player,module.exports=Player,Player.prototype._add=function(e,a){return null===e._handle?(e._handle=this._inactivePlayables.add(e),e._player=this,!0):e._handle.container===this._playablesToRemove?(e._handle=this._playablesToRemove.removeByReference(e._handle),!0):e._handle.container===this._activePlayables?(this._warn("[Player._add] Playable is already present, and active"),!1):e._handle.container===this._inactivePlayables?(this._warn("[Player._add] Playable is already present, but inactive (could be starting)"),!1):(this._warn("[Player._add] Playable is used elsewhere"),!1)},Player.prototype._remove=function(e){return null===e._handle?(this._warn("[Player._remove] Playable is not being used"),!1):e._handle.container===this._activePlayables?(e._handle=this._playablesToRemove.add(e._handle),!0):e._handle.container===this._inactivePlayables?(e._handle=this._inactivePlayables.removeByReference(e._handle),!0):e._handle.container===this._playablesToRemove?(this._warn("[Player._remove] Playable is already being removed"),!1):(this._warn("[Player._add] Playable is used elsewhere"),!1)},Player.prototype.remove=function(e){return e._handle.container===this._activePlayables&&e.stop(),e._handle.container!==this._playablesToRemove&&this._remove(e),this._onPlayableRemoved(e),this},Player.prototype.removeAll=function(){for(var e=this._activePlayables.first;null!==e;){var a=e.next;e.object.stop(),e=a}return this._handlePlayablesToRemove(),this._onAllPlayablesRemoved(),this},Player.prototype.possess=function(e){return null===e._handle?!1:e._handle.container===this._activePlayables||e._handle.container===this._inactivePlayables},Player.prototype._handlePlayablesToRemove=function(){for(;this._playablesToRemove.length>0;){var e=this._playablesToRemove.pop(),a=e.object;a._handle=this._activePlayables.removeByReference(e),a._player=null}},Player.prototype.clear=function(){return this._activePlayables.clear(),this._inactivePlayables.clear(),this._playablesToRemove.clear(),this._controls.clear(),this},Player.prototype._warn=function(e){this._silent===!1&&console.warn(e),this._debug===!0},Player.prototype.silent=function(e){return this._silent=e,this},Player.prototype.debug=function(e){return this._debug=e,this},Player.prototype.stop=function(){for(var e=this._activePlayables.first;null!==e;){var a=e.next,t=e.object;t.stop(),e=a}this._handlePlayablesToRemove(),Playable.prototype.stop.call(this)},Player.prototype._activate=function(e){this._inactivePlayables.removeByReference(e._handle),e._handle=this._activePlayables.addBack(e)},Player.prototype._inactivate=function(e){this._activePlayables.removeByReference(e._handle),e._handle=this._inactivePlayables.addBack(e)},Player.prototype._updatePlayableList=function(e){this._handlePlayablesToRemove();for(var a=this._inactivePlayables.first;null!==a;){var t=a.object;a=a.next;var l=t._startTime,i=l+t.getDuration();l<=this._time&&this._time<=i&&(this._inactivePlayables.removeByReference(t._handle),t._handle=this._activePlayables.addBack(t),t._start())}},Player.prototype._update=function(e){this._updatePlayableList(e);for(var a=this._activePlayables.first;null!==a;a=a.next)a.object._moveTo(this._time,e)},Player.prototype._onPlayableChanged=function(){},Player.prototype._onPlayableRemoved=function(){},Player.prototype._onAllPlayablesRemoved=function(){};

@@ -35,7 +35,7 @@ },{"./DoublyList":6,"./Playable":8}],10:[function(require,module,exports){

(function (global){
var root;"undefined"!=typeof window?root=window:"undefined"!=typeof global?root=global:(console.warn("[TINA] Your environment might not support TINA."),root=this);var requestAnimFrame=function(){return root.requestAnimationFrame||root.webkitRequestAnimationFrame||root.mozRequestAnimationFrame||root.oRequestAnimationFrame||root.msRequestAnimationFrame||function(t){root.setTimeout(t,1e3/60)}}(),clock=root.performance||Date,TINA={_tweeners:[],_defaultTweener:null,_startTime:0,_time:0,_running:!1,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,_pauseOnLostFocus:!1,_pauseOnLostFocusInitialised:!1,onStart:function(t){return this._onStart=t,this},onUpdate:function(t){return this._onUpdate=t,this},onStop:function(t){return this._onStop=t,this},onPause:function(t){return this._onPause=t,this},isRunning:function(){return this._running===!0},update:function(){var t=clock.now()-this._startTime,e=t-this._time;if(!(0>e)){this._time=t;for(var n=this._tweeners.slice(0),i=0;i<n.length;i+=1)n[i]._moveTo(this._time,e);null!==this._onUpdate&&this._onUpdate(this._time,e)}},reset:function(){this._startTime=clock.now(),this._time=0},start:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onStart&&this._onStart(),this._startTime=clock.now(),this._time=0;for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._start(0);return this}},stop:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=this._tweeners.slice(0),e=0;e<t.length;e+=1)t[e].stop();return this._tweeners=t,null!==this._onStop&&this._onStop(),this}},_startAutomaticUpdate:function(){function t(){TINA._running===!0&&(TINA.update(),requestAnimFrame(t))}return this._running===!0?(console.warn("[TINA.start] TINA is already running"),!1):(this._running=!0,requestAnimFrame(t),!0)},_stopAutomaticUpdate:function(){return this._running===!1?(console.warn("[TINA.pause] TINA is not running"),!1):(this._running=!1,!0)},pause:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._pause();return null!==this._onPause&&this._onPause(),this}},resume:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onResume&&this._onResume();var t=clock.now(),e=t-this._time;this._startTime+=e;for(var n=0;n<this._tweeners.length;n+=1)this._tweeners[n]._resume();return this}},_initialisePauseOnLostFocus:function(){if(this._pauseOnLostFocusInitialised!==!0){if(void 0===document)return void console.warn("[TINA.pauseOnLostFocus] Cannot pause on lost focus because TINA is not running in a webpage (node.js does not allow this functionality)");var t,e;if("undefined"!=typeof document.hidden?(t="hidden",e="visibilitychange"):"undefined"!=typeof document.mozHidden?(t="mozHidden",e="mozvisibilitychange"):"undefined"!=typeof document.msHidden?(t="msHidden",e="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange"),"undefined"==typeof document[t])return void console.warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API");this._pauseOnLostFocusInitialised=!0;var n=!1;document.addEventListener(e,function(){document[t]&&(n=TINA.isRunning(),n&&TINA._pauseOnLostFocus&&TINA.pause()),document[t]||n&&TINA._pauseOnLostFocus&&TINA.resume()},!1)}},pauseOnLostFocus:function(t){return t===!0&&this._pauseOnLostFocusInitialised===!1&&this._initialisePauseOnLostFocus(),this._pauseOnLostFocus=t,this},setDefaultTweener:function(t){this._defaultTweener=t,this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(t){this._running===!1&&this.start(),this._tweeners.push(t)},add:function(t){return this._tweeners.push(t),this},_inactivate:function(t){var e=this._tweeners.indexOf(t);-1!==e&&this._tweeners.splice(e,1)},remove:function(t){return this._inactivate(t),this},_getDefaultTweener:function(){if(null===this._defaultTweener){var t=this.Timer;this._defaultTweener=(new t).start()}return this._defaultTweener}};module.exports=global.TINA=TINA;
var root;"undefined"!=typeof window?root=window:"undefined"!=typeof global?root=global:(console.warn("[TINA] Your environment might not support TINA."),root=this);var requestAnimFrame=function(){return root.requestAnimationFrame||root.webkitRequestAnimationFrame||root.mozRequestAnimationFrame||root.oRequestAnimationFrame||root.msRequestAnimationFrame||function(t){root.setTimeout(t,1e3/60)}}(),clock=root.performance||Date,TINA={_tweeners:[],_defaultTweener:null,_startTime:0,_time:0,_running:!1,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,_pauseOnLostFocus:!1,_pauseOnLostFocusInitialised:!1,onStart:function(t){return this._onStart=t,this},onUpdate:function(t){return this._onUpdate=t,this},onStop:function(t){return this._onStop=t,this},onPause:function(t){return this._onPause=t,this},isRunning:function(){return this._running===!0},update:function(){var t=clock.now()-this._startTime,e=t-this._time;0>e?(e=1,this._startTime-=1,this._time+=1):this._time=t;for(var n=this._tweeners.slice(0),i=0;i<n.length;i+=1)n[i]._moveTo(this._time,e);null!==this._onUpdate&&this._onUpdate(this._time,e)},reset:function(){var t=clock.now(),e=t-this._time;this._startTime+=e,this._time=0},start:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onStart&&this._onStart();for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._start();return this}},stop:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=this._tweeners.slice(0),e=0;e<t.length;e+=1)t[e].stop();return this._tweeners=t,null!==this._onStop&&this._onStop(),this}},_startAutomaticUpdate:function(){function t(){TINA._running===!0&&(TINA.update(),requestAnimFrame(t))}return this._running===!0?(console.warn("[TINA.start] TINA is already running"),!1):(this.reset(),this._running=!0,requestAnimFrame(t),!0)},_stopAutomaticUpdate:function(){return this._running===!1?(console.warn("[TINA.pause] TINA is not running"),!1):(this._running=!1,!0)},pause:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._pause();return null!==this._onPause&&this._onPause(),this}},resume:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onResume&&this._onResume();for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._resume();return this}},_initialisePauseOnLostFocus:function(){if(this._pauseOnLostFocusInitialised!==!0){if(void 0===document)return void console.warn("[TINA.pauseOnLostFocus] Cannot pause on lost focus because TINA is not running in a webpage (node.js does not allow this functionality)");var t,e;if("undefined"!=typeof document.hidden?(t="hidden",e="visibilitychange"):"undefined"!=typeof document.mozHidden?(t="mozHidden",e="mozvisibilitychange"):"undefined"!=typeof document.msHidden?(t="msHidden",e="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange"),"undefined"==typeof document[t])return void console.warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API");this._pauseOnLostFocusInitialised=!0;var n=!1;document.addEventListener(e,function(){document[t]&&(n=TINA.isRunning(),n&&TINA._pauseOnLostFocus&&TINA.pause()),document[t]||n&&TINA._pauseOnLostFocus&&TINA.resume()},!1)}},pauseOnLostFocus:function(t){return t===!0&&this._pauseOnLostFocusInitialised===!1&&this._initialisePauseOnLostFocus(),this._pauseOnLostFocus=t,this},setDefaultTweener:function(t){this._defaultTweener=t,this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(t){this._running===!1&&this.start(),this._tweeners.push(t)},add:function(t){return this._tweeners.push(t),this},_inactivate:function(t){var e=this._tweeners.indexOf(t);-1!==e&&this._tweeners.splice(e,1)},remove:function(t){return this._inactivate(t),this},_getDefaultTweener:function(){if(null===this._defaultTweener){var t=this.Timer;this._defaultTweener=(new t).start()}return this._defaultTweener}};module.exports=global.TINA=TINA;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],12:[function(require,module,exports){
function Ticker(t){return this instanceof Ticker==!1?new Ticker(t):(Tweener.call(this),void(this.tupt=t||1))}var Tweener=require("./Tweener");Ticker.prototype=Object.create(Tweener.prototype),Ticker.prototype.constructor=Ticker,module.exports=Ticker,Ticker.prototype._getElapsedTime=function(){return this._nbTicks+=this.tupt,this._nbTicks},Ticker.prototype._getSingleStepDuration=function(){return this.tupt},Ticker.prototype.convertToTicks=function(t){return t/this.tupt},Ticker.prototype.convertToTimeUnits=function(t){return t*this.tupt};
function Ticker(t){return this instanceof Ticker==!1?new Ticker(t):(Tweener.call(this),void(this.tupt=t||1))}var Tweener=require("./Tweener");Ticker.prototype=Object.create(Tweener.prototype),Ticker.prototype.constructor=Ticker,module.exports=Ticker,Ticker.prototype._moveTo=function(t,e){e=this.tupt,this._time=this.tupt*this._nbTicks++,this._update(e),null!==this._onUpdate&&this._onUpdate(this._time,e)},Ticker.prototype.convertToTicks=function(t){return t/this.tupt},Ticker.prototype.convertToTimeUnits=function(t){return t*this.tupt};

@@ -46,3 +46,3 @@ },{"./Tweener":18}],13:[function(require,module,exports){

},{"./BriefPlayer":4}],14:[function(require,module,exports){
function Timer(t){return this instanceof Timer==!1?new Timer(t):(Tweener.call(this),void(this._tups=t||1e3))}var Tweener=require("./Tweener");Timer.prototype=Object.create(Tweener.prototype),Timer.prototype.constructor=Timer,module.exports=Timer,Object.defineProperty(Timer.prototype,"tups",{get:function(){return this._tups},set:function(t){0>t&&(this._warn("[Timer.tups] tups cannot be negative, stop messing with time."),t=0),0===t?this._startTime+=this._time/this._tups-this._time:0===this._tups?this._startTime=this._time-this._time/t:this._startTime=this._time/this._tups-this._time/t,this._tups=t}}),Timer.prototype._getElapsedTime=function(t){return this._tups*(t-this._startTime)/1e3},Timer.prototype._getSingleStepDuration=function(t){return this._tups*t/1e3},Timer.prototype.convertToSeconds=function(t){return t/this._tups},Timer.prototype.convertToTimeUnits=function(t){return t*this._tups};
function Timer(e){return this instanceof Timer==!1?new Timer(e):(Tweener.call(this),void(this._speed=e/1e3||1))}var Tweener=require("./Tweener");Timer.prototype=Object.create(Tweener.prototype),Timer.prototype.constructor=Timer,module.exports=Timer,Object.defineProperty(Timer.prototype,"tups",{get:function(){return 1e3*this._speed},set:function(e){this.speed=e/1e3}}),Timer.prototype.convertToSeconds=function(e){return e/(1e3*this._speed)},Timer.prototype.convertToTimeUnits=function(e){return e*this._speed*1e3};

@@ -59,3 +59,3 @@ },{"./Tweener":18}],15:[function(require,module,exports){

},{"./AbstractTween":1,"./BriefPlayable":3,"./inherit":21}],18:[function(require,module,exports){
function Tweener(){Player.call(this),this._player=TINA}var Player=require("./Player"),TINA=require("./TINA");Tweener.prototype=Object.create(Player.prototype),Tweener.prototype.constructor=Tweener,module.exports=Tweener,Tweener.prototype._inactivate=function(e){this._remove(e)},Tweener.prototype._moveTo=function(e,t){t=this._getSingleStepDuration(t)*this._speed,this._time=this._getElapsedTime(e-this._startTime)*this._speed,this._updatePlayableList(t),this._update(t),null!==this._onUpdate&&this._onUpdate(this._time,t)},Tweener.prototype.useAsDefault=function(){return TINA.setDefaultTweener(this),this};
function Tweener(){Player.call(this),this._player=TINA}var Player=require("./Player"),TINA=require("./TINA");Tweener.prototype=Object.create(Player.prototype),Tweener.prototype.constructor=Tweener,module.exports=Tweener,Tweener.prototype._inactivate=function(e){this._remove(e)},Tweener.prototype.useAsDefault=function(){return TINA.setDefaultTweener(this),this};

@@ -62,0 +62,0 @@ },{"./Player":9,"./TINA":11}],19:[function(require,module,exports){

{
"name": "tina",
"version": "0.3.1",
"version": "0.3.2",
"description": "Tweening and INterpolations for Animation",

@@ -5,0 +5,0 @@ "main": "src/index.js",

function BriefExtension() {
// A brief component has a duration
this._duration = 0;
// Local duration of the playable, independent from speed and iterations
this._duration = 0;
// And can complete
// On complete callback
this._onComplete = null;

@@ -11,4 +11,4 @@

this._iterations = 1; // Number of times to iterate the playable
this._pingpong = false; // To make the playable go backward on even iterations
this._persist = false; // To keep the playable running instead of completing
this._pingpong = false; // To make the playable go backward on even iterations
}

@@ -15,0 +15,0 @@

@@ -137,3 +137,3 @@ /** @class */

Playable.prototype._start = function (timeOffset) {
Playable.prototype._start = function () {
if (this._onStart !== null) {

@@ -182,7 +182,2 @@ this._onStart();

Playable.prototype._moveTo = function (time, dt) {
// N.B local time is calculated as follow: localTime = (GlobalTime - startTime) * speed
// Rather than using the following equation: localTime += dt
// The goal is to avoid stacking up rounding errors that could (in very rare cases)
// lead to callbacks not being triggered simultaneously, or not being triggered at all
dt *= this._speed;

@@ -198,4 +193,4 @@

// Overridable method
// Overridable methods
Playable.prototype._update = function () {};
Playable.prototype._validate = function () {};

@@ -218,3 +218,3 @@ var Playable = require('./Playable');

playable._start(this._time - startTime);
playable._start();
}

@@ -221,0 +221,0 @@ }

@@ -26,9 +26,11 @@ var Tweener = require('./Tweener');

Ticker.prototype._getElapsedTime = function () {
this._nbTicks += this.tupt;
return this._nbTicks;
};
Ticker.prototype._moveTo = function (time, dt) {
dt = this.tupt;
this._time = this.tupt * (this._nbTicks++);
Ticker.prototype._getSingleStepDuration = function () {
return this.tupt;
this._update(dt);
if (this._onUpdate !== null) {
this._onUpdate(this._time, dt);
}
};

@@ -35,0 +37,0 @@

@@ -19,3 +19,3 @@ var Tweener = require('./Tweener');

// Every second, 'tups' time units elapse
this._tups = tups || 1000;
this._speed = (tups / 1000) || 1;
}

@@ -27,41 +27,12 @@ Timer.prototype = Object.create(Tweener.prototype);

Object.defineProperty(Timer.prototype, 'tups', {
get: function () { return this._tups; },
set: function (tups) {
if (tups < 0) {
this._warn('[Timer.tups] tups cannot be negative, stop messing with time.');
tups = 0;
}
if (tups === 0) {
// Setting start as if new tups was 1
this._startTime += this._time / this._tups - this._time;
} else {
if (this._tups === 0) {
// If current tups is 0,
// it corresponds to a virtual tups of 1
// when it comes to determing where the start is
this._startTime = this._time - this._time / tups;
} else {
this._startTime = this._time / this._tups - this._time / tups;
}
}
this._tups = tups;
}
get: function () { return this._speed * 1000; },
set: function (tups) { this.speed = tups / 1000; }
});
Timer.prototype._getElapsedTime = function (time) {
return this._tups * (time - this._startTime) / 1000;
};
Timer.prototype._getSingleStepDuration = function (dt) {
return this._tups * dt / 1000;
};
Timer.prototype.convertToSeconds = function(timeUnits) {
return timeUnits / this._tups;
return timeUnits / (this._speed * 1000);
};
Timer.prototype.convertToTimeUnits = function(seconds) {
return seconds * this._tups;
return seconds * this._speed * 1000;
};

@@ -90,3 +90,3 @@

if (dt < 0) {
// Clock error, ignoring this update
// Clock error
// Date.now is based on a clock that is resynchronized

@@ -97,7 +97,9 @@ // every 15-20 mins and could cause the timer to go backward in time.

// http://updates.html5rocks.com/2012/08/When-milliseconds-are-not-enough-performance-now
return;
dt = 1; // incrementing time by 1 millisecond
this._startTime -= 1;
this._time += 1;
} else {
this._time = now;
}
this._time = now;
// Making a copy of the tweener array

@@ -118,3 +120,10 @@ // to avoid funky stuff happening

reset: function () {
this._startTime = clock.now();
// Resetting the clock
// Getting time difference between last update and now
var now = clock.now();
var dt = now - this._time;
// Moving starting time by this difference
// As if the time had virtually not moved
this._startTime += dt;
this._time = 0;

@@ -132,8 +141,4 @@ },

// Setting the clock
this._startTime = clock.now();
this._time = 0;
for (var t = 0; t < this._tweeners.length; t += 1) {
this._tweeners[t]._start(0);
this._tweeners[t]._start();
}

@@ -179,2 +184,4 @@

this.reset();
// Starting the animation loop

@@ -222,11 +229,2 @@ this._running = true;

// Resetting the clock
// Getting time difference between last update and now
var now = clock.now();
var dt = now - this._time;
// Moving starting time by this difference
// As if the time had virtually not moved
this._startTime += dt;
for (var t = 0; t < this._tweeners.length; t += 1) {

@@ -233,0 +231,0 @@ this._tweeners[t]._resume();

@@ -19,18 +19,6 @@ var Player = require('./Player');

Tweener.prototype._inactivate = function (playable) {
// In a tweener, a playable that finishes is simply removed
// In a tweener, playables are removed when inactivated
this._remove(playable);
};
Tweener.prototype._moveTo = function (time, dt) {
dt = this._getSingleStepDuration(dt) * this._speed;
this._time = this._getElapsedTime(time - this._startTime) * this._speed;
this._updatePlayableList(dt);
this._update(dt);
if (this._onUpdate !== null) {
this._onUpdate(this._time, dt);
}
};
Tweener.prototype.useAsDefault = function () {

@@ -37,0 +25,0 @@ TINA.setDefaultTweener(this);

Sorry, the diff of this file is too big to display

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