Comparing version 0.1.6 to 0.2.0
@@ -1,3 +0,3 @@ | ||
function require(name){var module=require.modules[name];if(!module)throw new Error('failed to require "'+name+'"');if(!("exports"in module)&&typeof module.definition==="function"){module.client=module.component=true;module.definition.call(this,module.exports={},module);delete module.definition}return module.exports}require.loader="component";require.helper={};require.helper.semVerSort=function(a,b){var aArray=a.version.split(".");var bArray=b.version.split(".");for(var i=0;i<aArray.length;++i){var aInt=parseInt(aArray[i],10);var bInt=parseInt(bArray[i],10);if(aInt===bInt){var aLex=aArray[i].substr((""+aInt).length);var bLex=bArray[i].substr((""+bInt).length);if(aLex===""&&bLex!=="")return 1;if(aLex!==""&&bLex==="")return-1;if(aLex!==""&&bLex!=="")return aLex>bLex?1:-1;continue}else if(aInt>bInt){return 1}else{return-1}}return 0};require.latest=function(name,returnPath){function showError(name){throw new Error('failed to find latest module of "'+name+'"')}var versionRegexp=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;var remoteRegexp=/(.*)~(.*)/;if(!remoteRegexp.test(name))showError(name);var moduleNames=Object.keys(require.modules);var semVerCandidates=[];var otherCandidates=[];for(var i=0;i<moduleNames.length;i++){var moduleName=moduleNames[i];if(new RegExp(name+"@").test(moduleName)){var version=moduleName.substr(name.length+1);var semVerMatch=versionRegexp.exec(moduleName);if(semVerMatch!=null){semVerCandidates.push({version:version,name:moduleName})}else{otherCandidates.push({version:version,name:moduleName})}}}if(semVerCandidates.concat(otherCandidates).length===0){showError(name)}if(semVerCandidates.length>0){var module=semVerCandidates.sort(require.helper.semVerSort).pop().name;if(returnPath===true){return module}return require(module)}var module=otherCandidates.sort(function(a,b){return a.name>b.name})[0].name;if(returnPath===true){return module}return require(module)};require.modules={};require.register=function(name,definition){require.modules[name]={definition:definition}};require.define=function(name,exports){require.modules[name]={exports:exports}};require.register("tina/src/Delay.js",function(exports,module){var Playable=require("tina/src/Playable.js");function Delay(duration){if(this instanceof Delay===false){return new Delay(duration)}Playable.call(this);this._duration=duration}Delay.prototype=Object.create(Playable.prototype);Delay.prototype.constructor=Delay;module.exports=Delay});require.register("tina/src/DoublyList.js",function(exports,module){function ListNode(obj,prev,next,container){this.object=obj;this.prev=prev;this.next=next;this.container=container}function DoublyList(){this.first=null;this.last=null;this.length=0}module.exports=DoublyList;DoublyList.prototype.addFront=function(obj){var newNode=new ListNode(obj,null,this.first,this);if(this.first===null){this.first=newNode;this.last=newNode}else{this.first.prev=newNode;this.first=newNode}this.length+=1;return newNode};DoublyList.prototype.add=DoublyList.prototype.addFront;DoublyList.prototype.addBack=function(obj){var newNode=new ListNode(obj,this.last,null,this);if(this.first===null){this.first=newNode;this.last=newNode}else{this.last.next=newNode;this.last=newNode}this.length+=1;return newNode};DoublyList.prototype.popFront=function(obj){var object=this.first.object;this.remove(this.first);return object};DoublyList.prototype.pop=DoublyList.prototype.popFront;DoublyList.prototype.popBack=function(obj){var object=this.last.object;this.remove(this.last);return object};DoublyList.prototype.remove=function(node){if(node.container!==this){console.warn("[DoublyList.remove] Trying to remove a node that does not belong to the list");return node}if(node.next===null){this.last=node.prev}else{node.next.prev=node.prev}if(node.prev===null){this.first=node.next}else{node.prev.next=node.next}node.container=null;this.length-=1;return null};DoublyList.prototype.clear=function(){for(var node=this.first;node!==null;node=node.next){node.container=null}this.first=null;this.last=null;this.length=0}});require.register("tina/src/easing.js",function(exports,module){var PI=Math.PI;var PI_OVER_TWO=Math.PI/2;var TWO_PI=Math.PI*2;var EXP=2.718281828;exports.none=function(){return 1};exports.linear=function(t){return t};exports.flash=function(t,ease){return t+t*ease-t*t*ease};exports.parabolic=function(t){var r=2*t-1;return 1-r*r};exports.trigo=function(t,n){return.5*(1-Math.cos(TWO_PI*t*n))};exports.elastic=function(t,e){if(t===1)return 1;e=1-1/(e+1);var n=(1+e)*Math.log(1-t)/Math.log(e);return Math.cos(n-PI_OVER_TWO)*Math.pow(e,n)};exports.polyIn=function(t,p){return Math.pow(t,p)};exports.polyOut=function(t,p){return 1-Math.pow((1-t)/1,p)};exports.polyInOut=function(t,p){if(t<.5){return Math.pow(2*t,p)/2}else{return(1+(1-Math.pow(2*(1-t),p)))/2}};exports.sineIn=function(t){return 1-Math.cos(PI_OVER_TWO*t)};exports.sineOut=function(t){return Math.sin(PI_OVER_TWO*t)};exports.sineInOut=function(t){if(t<.5){return(1-Math.cos(PI*t))/2}else{return(1+Math.sin(PI*(t-.5)))/2}};exports.expIn=function(t,e){return(1-Math.pow(EXP,e*t))/(1-Math.pow(EXP,e))};exports.expOut=function(t,e){return(1-Math.pow(EXP,-e*t))/(1-Math.pow(EXP,-e))};exports.expInOut=function(t,e){if(t<.5){return(1-Math.pow(EXP,2*e*t))/(1-Math.pow(EXP,e))/2}else{return.5+(1-Math.pow(EXP,e-2*e*t))/(1-Math.pow(EXP,-e))/2}};exports.circIn=function(t){return 1-Math.sqrt(1-Math.pow(t,2))};exports.circOut=function(t){return Math.sqrt(1-Math.pow(1-t,2))};exports.circInOut=function(t){if(t<.5){return(1-Math.sqrt(1-4*t*t))/2}else{return(1+Math.sqrt(-3+8*t-4*t*t))/2}};exports.elasticIn=function(t,e){if(t===0){return 0}e/=e+1;var n=(1+e)*Math.log(t)/Math.log(e);return Math.cos(n)*Math.pow(e,n)};exports.elasticOut=function(t,e){if(t===1){return 1}e/=e+1;var n=(1+e)*Math.log(1-t)/Math.log(e);return 1-Math.cos(n)*Math.pow(e,n)};exports.elasticInOut=function(t,e){var n;if(t<.5){if(t===0){return 0}e/=e+1;n=(1+e)*Math.log(2*t)/Math.log(e);return.5*Math.cos(n)*Math.pow(e,n)}if(t===1){return 1}e/=e+1;n=(1+e)*Math.log(2-2*t)/Math.log(e);return.5+.5*(1-Math.cos(n)*Math.pow(e,n))};exports.bounceIn=function(t,e){if(t===0){return 0}e/=e+1;var n=(1+e)*Math.log(t)/Math.log(e);return Math.abs(Math.cos(n)*Math.pow(e,n))};exports.bounceOut=function(t,e){if(t===1){return 1}e/=e+1;var n=(1+e)*Math.log(1-t)/Math.log(e);return 1-Math.abs(Math.cos(n)*Math.pow(e,n))};exports.bounceInOut=function(t,e){var n;if(t<.5){if(t===0){return 0}e/=e+1;n=(1+e)*Math.log(2*t)/Math.log(e);return Math.abs(.5*Math.cos(n)*Math.pow(e,n))}if(t===1){return 1}e/=e+1;n=(1+e)*Math.log(2-2*t)/Math.log(e);return.5+.5*(1-Math.abs(Math.cos(n)*Math.pow(e,n)))};exports.backIn=function(t,e){return t*t*((e+1)*t-e)};exports.backOut=function(t,e){t-=1;return t*t*((e+1)*t+e)+1};exports.backInOut=function(t,e){if(t<.5){t*=2;return.5*(t*t*((e+1)*t-e))}t=2*t-2;return.5*(t*t*((e+1)*t+e))+1}});require.register("tina",function(exports,module){var requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}();var clock=window.performance||Date;var TINA={Tweener:require("tina/src/Tweener.js"),Timer:require("tina/src/Timer.js"),Ticker:require("tina/src/Ticker.js"),Playable:require("tina/src/Playable.js"),Player:require("tina/src/Player.js"),Tween:require("tina/src/Tween.js"),TweenRelative:require("tina/src/TweenRelative.js"),Timeline:require("tina/src/Timeline.js"),Sequence:require("tina/src/Sequence.js"),Recorder:require("tina/src/Recorder.js"),Delay:require("tina/src/Delay.js"),easing:require("tina/src/easing.js"),interpolation:require("tina/src/interpolation.js"),_tweeners:[],_defaultTweener:null,_running:false,_startTime:0,_time:0,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,onStart:function(onStart){this._onStart=onStart;return this},onUpdate:function(onUpdate){this._onUpdate=onUpdate;return this},onStop:function(onStop){this._onStop=onStop;return this},onPause:function(onPause){this._onPause=onPause;return this},isRunning:function(){return this._running},update:function(){var now=clock.now()-this._startTime;var dt=now-this._time;if(dt<0){return}this._time=now;var runningTweeners=this._tweeners.slice(0);for(var t=0;t<runningTweeners.length;t+=1){runningTweeners[t]._moveTo(this._time,dt)}if(this._onUpdate!==null){this._onUpdate(this._time,dt)}},reset:function(){this._startTime=clock.now();this._time=0},start:function(){if(this._running===true){console.warn("[TINA.start] TINA is already running");return this}var self=this;var selfUpdate=function(){if(self._running===true){self.update();requestAnimFrame(selfUpdate)}};if(this._onStart!==null){this._onStart()}this._startTime=clock.now();this._time=0;for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._start()}this._running=true;requestAnimFrame(selfUpdate);return this},pause:function(){if(this._running===false){console.warn("[TINA.pause] TINA is not running");return this}this._running=false;for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._pause()}if(this._onPause!==null){this._onPause()}return this},resume:function(){if(this._running===true){console.warn("[TINA.resume] TINA is already running");return this}this._running=true;if(this._onResume!==null){this._onResume()}for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._resume()}var now=clock.now();var dt=now-this._time;this._startTime+=dt;return this},stop:function(){this._running=false;var runningTweeners=this._tweeners.slice(0);for(var t=0;t<runningTweeners.length;t+=1){runningTweeners[t]._stop()}if(this._onStop!==null){this._onStop()}return this},setDefaultTweener:function(tweener){this._defaultTweener=tweener;this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(tweener){if(this._running===false){this.start()}this._tweeners.push(tweener)},add:function(tweener){this._tweeners.push(tweener);return this},_remove:function(tweener){var tweenerIdx=this._tweeners.indexOf(tweener);if(tweenerIdx!==-1){this._tweeners.splice(tweenerIdx,1)}},remove:function(tweener){this._remove(tweener);return this},_getDefaultTweener:function(){if(this._defaultTweener===null){var DefaultTweener=this.Timer;this._defaultTweener=(new DefaultTweener).start()}return this._defaultTweener}};var hidden,visbilityChange;if(typeof document.hidden!=="undefined"){hidden="hidden";visbilityChange="visibilitychange"}else if(typeof document.mozHidden!=="undefined"){hidden="mozHidden";visbilityChange="mozvisibilitychange"}else if(typeof document.msHidden!=="undefined"){hidden="msHidden";visbilityChange="msvisibilitychange"}else if(typeof document.webkitHidden!=="undefined"){hidden="webkitHidden";visbilityChange="webkitvisibilitychange"}if(typeof document[hidden]==="undefined"){this._warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API")}else{var wasRunning=false;document.addEventListener(visbilityChange,function(){if(document[hidden]){wasRunning=TINA.isRunning();if(wasRunning){TINA.pause()}}if(!document[hidden]){if(wasRunning){TINA.resume()}}},false)}(function(root){root.TINA=TINA})(this);module.exports=TINA});require.register("tina/src/interpolation.js",function(exports,module){exports.none=function(t,a,b){return b};exports.linear=function(t,a,b){return a*(1-t)+b*t};exports.discrete=function(t,a,b,d){return Math.floor((a*(1-t)+b*t)/d)*d};exports.vector=function(t,a,b){var c=[];for(var i=0;i<a.length;i+=1){c[i]=a[i]*(1-t)+b[i]*t}return c};exports.state=function(t,a,b,c){var nbStates=b.length+2;var stateIdx=Math.floor(t*nbStates);if(stateIdx<1){return a}if(stateIdx>=nbStates-1){return b}return c[stateIdx-1]};exports.colorRGB=function(t,a,b){return{r:a.r*(1-t)+b.r*t,g:a.g*(1-t)+b.g*t,b:a.b*(1-t)+b.b*t}};exports.colorRGBA=function(t,a,b){return{r:a.r*(1-t)+b.r*t,g:a.g*(1-t)+b.g*t,b:a.b*(1-t)+b.b*t,a:a.a*(1-t)+b.a*t}};exports.colorRGBToHexa=function(t,a,b){var cr=Math.round(a.r*(1-t)+b.r*t);var cg=Math.round(a.g*(1-t)+b.g*t);var cb=Math.round(a.b*(1-t)+b.b*t);return"#"+cr.toString(16)+cg.toString(16)+cb.toString(16)};exports.colorRGBAToString=function(t,a,b){var cr=Math.round(a.r*(1-t)+b.r*t);var cg=Math.round(a.g*(1-t)+b.g*t);var cb=Math.round(a.b*(1-t)+b.b*t);var ca=Math.round(a.a*(1-t)+b.a*t);return"rgba("+cr.toString(16)+","+cg.toString(16)+","+cb.toString(16)+","+ca+")"};exports.string=function(t,a,b){var nbCharsA=a.length;var nbCharsB=b.length;var newString="";for(var c=0;c<nbCharsB;c+=1){var charCodeB=b.charCodeAt(c);var charCodeA=c>=nbCharsA?charCodeB<97?65:97:a.charCodeAt(c);var charCode=Math.round(charCodeA*(1-t)+charCodeB*t);newString+=String.fromCharCode(charCode)}return newString};exports.bezierQuadratic=function(t,a,b,c){var u=1-t;return u*u*a+t*(2*u*c[0]+t*b)};exports.bezierCubic=function(t,a,b,c){var u=1-t;return u*u*u*a+t*(3*u*u*c[0]+t*(3*u*c[1]+t*b))};exports.bezierQuartic=function(t,a,b,c){var u=1-t;var u2=2*u;return u2*u2*a+t*(4*u*u2*c[0]+t*(6*u2*c[1]+t*(4*u*c[2]+t*b)))};exports.bezierQuintic=function(t,a,b,c){var u=1-t;var u2=2*u;return u2*u2*u*a+t*(5*u2*u2*c[0]+t*(10*u*u2*c[1]+t*(10*u2*c[2]+t*(5*u*c[3]+t*b))))};exports.bezier=function(t,a,b,c){var n=c.length;var u=1-t;var x=b;var term=n;for(k=1;k<n;k-=1){x=x*t+term*Math.pow(u,k)*c[n-k];term*=(n-k)/(k+1)}return x*t+a*Math.pow(u,n)};exports.bezier2d=function(t,a,b,c){var n=c.length;var u=1-t;var x=b[0];var y=b[1];var p,q;var term=n;for(var k=1;k<n;k-=1){p=term*Math.pow(u,k);q=c[n-k];x=x*t+p*q[0];y=y*t+p*q[1];term*=(n-k)/(k+1)}p=Math.pow(u,n);return[x*t+a[0]*p,y*t+a[1]*p]};exports.bezier3d=function(t,a,b,c){var n=c.length;var u=1-t;var x=b[0];var y=b[1];var z=b[2];var p,q;var term=n;for(var k=1;k<n;k-=1){p=term*Math.pow(u,k);q=c[n-k];x=x*t+p*q[0];y=y*t+p*q[1];z=z*t+p*q[2];term*=(n-k)/(k+1)}p=Math.pow(u,n);return[x*t+a[0]*p,y*t+a[1]*p,z*t+a[2]*p]};exports.bezierKd=function(t,a,b,c){var n=c.length;var u=1-t;var k=a.length;var res=[];for(var i=0;i<k;i+=1){res[i]=b[i]}var p,q;var term=n;for(var l=1;l<n;l-=1){p=term*Math.pow(u,l);q=c[n-l];for(i=0;i<k;i+=1){res[i]=res[i]*t+p*q[i]}term*=(n-l)/(l+1)}p=Math.pow(u,n);for(i=0;i<k;i+=1){res[i]=res[i]*t+a[i]*p}return res};exports.catmullRom=function(t,a,b,c){if(t===1){return b[b.length-1]}var k=b[0].length;var n=b.length-1;t*=n;var i=Math.floor(t);t-=i;var t2=t*t;var t3=t*t2;var w=-.5*t3+1*t2-.5*t;var x=1.5*t3-2.5*t2+1;var y=-1.5*t3+2*t2+.5*t;var z=.5*t3-.5*t2;var p0=b[Math.max(0,i-1)];var p1=b[i];var p2=b[Math.min(n,i+1)];var p3=b[Math.min(n,i+2)];var res=[];for(var j=0;j<k;j+=1){res[j]=p0[j]*w+p1[j]*x+p2[j]*y+p3[j]*z}return res};exports.noise=function(){var perm=[182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216,182];var grad=[-1,1];return function(t,a,b,p){var amp=2;var per=p.per||1;var frq=p.frq||2;var oct=p.oct||4;var off=p.off||0;var c=0;var x=p.x+off;for(var o=0;o<oct;o+=1){var i=(x|x)&255;var x1=x-(x|x);var x0=1-x1;c+=amp*(x0*x0*x1*(3-2*x0)*grad[perm[i]&1]-x1*x1*x0*(3-2*x1)*grad[perm[i+1]&1]);x*=(x-off)*frq+off;amp*=per}var scale=per===1?1/oct:.5*(1-per)/(1-Math.pow(per,oct));t=t+c*scale;return a*(1-t)+b*t}}();exports.simplex2d=function(){var perm=[182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216,182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216];var grad=[[1,1],[-1,1],[1,-1],[-1,-1],[1,0],[-1,0],[1,0],[-1,0],[0,1],[0,-1],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]];function dot2D(g,x,y){return g[0]*x+g[1]*y}return function(t,a,b,p){var amp=2;var per=p.per||1;var frq=p.frq||2;var oct=p.oct||4;var off=p.off||{x:0,y:0};var c=c;var x=p.x+off.x;var y=p.y+off.y;for(var o=0;o<oct;o+=1){var n0,n1,n2;var f2=.5*(Math.sqrt(3)-1);var s=(x+y)*f2;var i=Math.floor(x+s);var j=Math.floor(y+s);var g2=(3-Math.sqrt(3))/6;var t=(i+j)*g2;var x0=i-t;var y0=j-t;x0=x-x0;y0=y-y0;var i1,j1;if(x0>y0){i1=1;j1=0}else{i1=0;j1=1}var x1=x0-i1+g2;var y1=y0-j1+g2;var x2=x0-1+2*g2;var y2=y0-1+2*g2;var ii=i&255;var jj=j&255;var t0=.5-x0*x0-y0*y0;var t1=.5-x1*x1-y1*y1;var t2=.5-x2*x2-y2*y2;if(t0<0){n0=0}else{var gi0=perm[ii+perm[jj]]&15;t0*=t0;n0=t0*t0*dot2D(grad[gi0],x0,y0)}if(t1<0){n1=0}else{var gi1=perm[ii+i1+perm[jj+j1]]&15;t1*=t1;n1=t1*t1*dot2D(grad[gi1],x1,y1)}if(t2<0){n2=0}else{var gi2=perm[ii+1+perm[jj+1]]&15;t2*=t2;n2=t2*t2*dot2D(grad[gi2],x2,y2)}c+=amp*70*(n0+n1+n2);x*=(x-off.x)*frq+off.x;y*=(y-off.y)*frq+off.y;amp*=per}var scale=per===1?1/oct:.5*(1-per)/(1-Math.pow(per,oct));t=t+c*scale;return a*(1-t)+b*t}}()});require.register("tina/src/Playable.js",function(exports,module){function Playable(){this._startTime=0;this._time=0;this._duration=0;this._iterations=1;this._handle=null;this._player=null;this._onStart=null;this._onPause=null;this._onResume=null;this._onUpdate=null;this._onStop=null;this._onComplete=null}module.exports=Playable;Playable.prototype.tweener=function(tweener){this._player=tweener;return this};Playable.prototype.getDuration=function(){return this._duration};Playable.prototype.goTo=function(time){this._startTime=this._time-time;return this};Playable.prototype.goToBeginning=function(){this.goTo(0);return this};Playable.prototype.goToEnd=function(){this.goTo(this.getDuration());return this};Playable.prototype.iterations=function(iterations){this._iterations=iterations;return this};Playable.prototype.onStart=function(onStart){this._onStart=onStart;return this};Playable.prototype.onUpdate=function(onUpdate){this._onUpdate=onUpdate;return this};Playable.prototype.onStop=function(onStop){this._onStop=onStop;return this};Playable.prototype.onComplete=function(onComplete){this._onComplete=onComplete;return this};Playable.prototype.onPause=function(onPause){this._onPause=onPause;return this};Playable.prototype.onResume=function(onResume){this._onResume=onResume;return this};Playable.prototype._update=function(){if(this._onUpdate!==null){this._onUpdate()}};Playable.prototype._stop=function(){if(this._onStop!==null){this._onStop()}};Playable.prototype._pause=function(){if(this._onPause!==null){this._onPause()}};Playable.prototype._resume=function(){if(this._onResume!==null){this._onResume()}};Playable.prototype.delay=function(delay){if(this._player===null){this._player=TINA._getDefaultTweener()}this._player._delay(this,delay);return this};Playable.prototype.start=function(timeOffset){var player=this._player;if(player===null){player=TINA._getDefaultTweener()}if(player._add(this)===false){return this}if(timeOffset===undefined||timeOffset===null){timeOffset=0}this._start(player,timeOffset-player._time);return this};Playable.prototype._start=function(player,timeOffset){this._player=player;this._startTime=-timeOffset;if(this._onStart!==null){this._onStart()}};Playable.prototype.stop=function(){if(this._player._finish(this)===false){return this}this._stop();return this};Playable.prototype.resume=function(){if(this._player._add(this)===false){return this}this._resume();return this};Playable.prototype.pause=function(){if(this._player._finish(this)===false){return this}this._pause();return this};Playable.prototype._complete=function(overflow){if(this._player._finish(this)===false){return this}if(this._onComplete!==null){this._onComplete(overflow)}};Playable.prototype._moveTo=function(time,dt){var overflow;if(this._iterations===1){this._time=time-this._startTime;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}}else{time=time-this._startTime;var iteration=time/this._duration;if(dt>0){if(iteration<this._iterations){this._time=time%this._duration}else{overflow=(iteration-this._iterations)*this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(0<iteration){this._time=time%this._duration}else{overflow=iteration*this._duration;dt-=overflow;this._time=0}}}this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};Playable.prototype._update=function(){}});require.register("tina/src/Player.js",function(exports,module){var DoublyList=require("tina/src/DoublyList.js");var Playable=require("tina/src/Playable.js");function PlayableHandle(playable){this.playable=playable;this.handle=null}function Player(){Playable.call(this);this._activePlayables=new DoublyList;this._inactivePlayables=new DoublyList;this._playablesToRemove=new DoublyList;this._silent=false;this._debug=false}Player.prototype=Object.create(Playable.prototype);Player.prototype.constructor=Player;module.exports=Player;Player.prototype._moveTo=function(time,dt){this._time=time-this._startTime;var overflow;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}this._updatePlayableList();this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};Player.prototype._add=function(playable){if(playable._handle===null){playable._handle=this._inactivePlayables.add(playable);return true}if(playable._handle.container===this._playablesToRemove){playable._handle=this._playablesToRemove.remove(playable._handle);return true}if(playable._handle.container===this._activePlayables){this._warn("[Player._add] Playable is already present, and active");return false}if(playable._handle.container===this._inactivePlayables){this._warn("[Player._add] Playable is already present, but inactive (could be starting)");return false}this._warn("[Player._add] Playable is used elsewhere");return false};Player.prototype._remove=function(playable){if(playable._handle===null){this._warn("[Player._remove] Playable is not being used");return false}if(playable._handle.container===this._activePlayables){playable._handle=this._playablesToRemove.add(playable._handle);return true}if(playable._handle.container===this._inactivePlayables){playable._handle=this._inactivePlayables.remove(playable._handle);return true}if(playable._handle.container===this._playablesToRemove){this._warn("[Player._remove] Playable is already being removed");return false}this._warn("[Player._add] Playable is used elsewhere");return false};Player.prototype.possess=function(playable){if(playable._handle===null){return false}return playable._handle.container===this._activePlayables||playable._handle.container===this._inactivePlayables};Player.prototype._finish=function(playable){this._activePlayables.remove(playable._handle);playable._handle=this._inactivePlayables.add(playable)};Player.prototype._handlePlayablesToRemove=function(){while(this._playablesToRemove.length>0){var handle=this._playablesToRemove.pop();var playable=handle.object;playable._handle=this._activePlayables.remove(handle)}};Player.prototype._updatePlayableList=function(){};Player.prototype.clear=function(){this._handledPlayables.clear();this._activePlayables.clear();this._inactivePlayables.clear();this._playablesToRemove.clear();return this};Player.prototype.stop=function(){var handle=this._activePlayables.first;while(handle!==null){var next=handle.next;var playable=handle.object;playable.stop();handle=next}this._handlePlayableToRemove();this._stop();return this};Player.prototype._delay=function(){this._warn("[Player._delay] This player does not support the delay functionality")};Player.prototype._warn=function(warning){if(this._silent===false){console.warn(warning)}if(this._debug===true){debugger}};Player.prototype.silent=function(silent){this._silent=silent;return this};Player.prototype.debug=function(debug){this._debug=debug;return this}});require.register("tina/src/Recorder.js",function(exports,module){var Playable=require("tina/src/Playable.js");function ObjectRecorder(object,properties){this.object=object;this.properties=properties;this.timestamps=[];this.records=[];this.playingHead=1}ObjectRecorder.prototype.record=function(time){for(var p=0;p<this.properties.length;p+=1){this.records.push(this.object[this.properties[p]])}this.timestamps.push(time)};ObjectRecorder.prototype.play=function(time,smooth){var nbProperties=this.properties.length;var lastRecord=this.timestamps.length-1;var playingHead=this.playingHead;while(playingHead<lastRecord&&time<=this.timestamps[playingHead]){playingHead+=1}while(playingHead>1&&time>this.timestamps[playingHead]){playingHead-=1}if(smooth){var t0=this.timestamps[playingHead-1];var t1=this.timestamps[playingHead];var dt=t1-t0;var delta0=(t-t0)/dt;var delta1=(t1-t)/dt;var recordIdx1=nbProperties*playingHead;var recordIdx0=nbProperties*playingHead-nbProperties;for(var p=0;p<nbProperties;p+=1){this.object[this.properties[p]]=this.records[recordIdx0+p]*delta0+this.records[recordIdx1+p]*delta1}}else{var recordIdx=nbProperties*playingHead;for(var p=0;p<nbProperties;p+=1){this.object[this.properties[p]]=this.records[recordIdx+p]}}};function Recorder(){if(this instanceof Recorder===false){return new Recorder}Playable.call(this);this._duration=Infinity;this._objectRecorders=[];this._recording=true;this._playing=false;this._smooth=false}Recorder.prototype=Object.create(Playable.prototype);Recorder.prototype.constructor=Recorder;module.exports=Recorder;Recorder.prototype.reset=function(){this._objectRecorders=[];return this};Recorder.prototype.record=function(object,properties){this._objectRecorders.push(new ObjectRecorder(object,properties));return this};Recorder.prototype.remove=function(object){var nbObjectRecorders=this._objectRecorders.length;for(var r=0;r<nbObjectRecorders;r+=1){if(this._objectRecorders[r].object===object){this._objectRecorders.splice(1,r);break}}return this};Recorder.prototype.recording=function(recording){this._recording=recordingMode;if(this._recording===true){this._playing=false}return this};Recorder.prototype.playing=function(playing){this._playing=playingMode;if(this._playing===true){this._recording=false}return this};Recorder.prototype.smooth=function(smooth){this._smooth=smooth;return this};Recorder.prototype.update=function(dt){if(this._recording){var nbObjectRecorders=this._objectRecorders.length;for(var r=0;r<nbObjectRecorders;r+=1){this._objectRecorders[r].record(this._time)}}if(this._playing){var nbObjectRecorders=this._objectRecorders.length;for(var r=0;r<nbObjectRecorders;r+=1){this._objectRecorders[r].play(this._time,this._smooth)}}}});require.register("tina/src/Sequence.js",function(exports,module){var Timeline=require("tina/src/Timeline.js");function Sequence(){if(this instanceof Sequence===false){return new Sequence}Timeline.call(this)}Sequence.prototype=Object.create(Timeline.prototype);Sequence.prototype.constructor=Sequence;module.exports=Sequence;Sequence.prototype.add=function(playable){playable._startTime=this._duration;this._duration+=playable._duration;this._add(playable);return this};Sequence.prototype.addDelay=function(duration){this._duration+=duration;return this}});require.register("tina/src/Ticker.js",function(exports,module){var Tweener=require("tina/src/Tweener.js");function Ticker(tupt){if(this instanceof Ticker===false){return new Ticker(tupt)}Tweener.call(this);this._tupt=tupt||1;this._nbTicks=0}Ticker.prototype=Object.create(Tweener.prototype);Ticker.prototype.constructor=Ticker;module.exports=Ticker;Object.defineProperty(Ticker.prototype,"tupt",{get:function(){return this._tupt},set:function(tupt){if(tupt<0){this._warn("[Timer.tupt] tupt cannot be negative, stop messing with time.");tupt=0}var dt=this._nbTicks;if(tupt===0){this._nbTicks=this._time-dt*this._tupt}else{if(this._tupt===0){this._nbTicks=this._time-dt/tupt}else{this._nbTicks=this._time-dt*this._tupt/tupt}}this._tupt=tupt}});Ticker.prototype._getElapsedTime=function(){return this._tupt*this._nbTicks++};Ticker.prototype._getSingleStepDuration=function(){return this._tupt};Ticker.prototype.convertToTicks=function(timeUnits){return timeUnits/this._tupt};Ticker.prototype.convertToTimeUnits=function(nbTicks){return nbTicks*this._tupt}});require.register("tina/src/Timeline.js",function(exports,module){var Player=require("tina/src/Player.js");function Timeline(){if(this instanceof Timeline===false){return new Timeline}Player.call(this)}Timeline.prototype=Object.create(Player.prototype);Timeline.prototype.constructor=Timeline;module.exports=Timeline;Timeline.prototype.add=function(startTime,playable){playable._startTime=startTime;this._add(playable);this._duration=Math.max(this._duration,startTime+playable._duration);return this};Timeline.prototype._computeDuration=function(){var duration=0;for(var handle=this._inactivePlayables.first;handle!==null;handle=handle.next){var playable=handle.object;duration=Math.max(duration,playable._startTime+playable._duration)}for(handle=this._activePlayables.first;handle!==null;handle=handle.next){playable=handle.object;duration=Math.max(duration,playable._startTime+playable._duration)}this._duration=duration};Timeline.prototype.remove=function(playable){this._remove(playable);return this};Timeline.prototype._start=function(player,timeOffset){Player.prototype._start.call(this,player,timeOffset);this._computeDuration()};Timeline.prototype._updatePlayableList=function(){this._handlePlayablesToRemove();var handle=this._inactivePlayables.first;while(handle!==null){var playable=handle.object;handle=handle.next;var startTime=playable._startTime;var endTime=startTime+playable._duration;if(startTime<=this._time&&this._time<=endTime){this._inactivePlayables.remove(playable._handle);playable._handle=this._activePlayables.add(playable); | ||
function require(name){var module=require.modules[name];if(!module)throw new Error('failed to require "'+name+'"');if(!("exports"in module)&&typeof module.definition==="function"){module.client=module.component=true;module.definition.call(this,module.exports={},module);delete module.definition}return module.exports}require.loader="component";require.helper={};require.helper.semVerSort=function(a,b){var aArray=a.version.split(".");var bArray=b.version.split(".");for(var i=0;i<aArray.length;++i){var aInt=parseInt(aArray[i],10);var bInt=parseInt(bArray[i],10);if(aInt===bInt){var aLex=aArray[i].substr((""+aInt).length);var bLex=bArray[i].substr((""+bInt).length);if(aLex===""&&bLex!=="")return 1;if(aLex!==""&&bLex==="")return-1;if(aLex!==""&&bLex!=="")return aLex>bLex?1:-1;continue}else if(aInt>bInt){return 1}else{return-1}}return 0};require.latest=function(name,returnPath){function showError(name){throw new Error('failed to find latest module of "'+name+'"')}var versionRegexp=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;var remoteRegexp=/(.*)~(.*)/;if(!remoteRegexp.test(name))showError(name);var moduleNames=Object.keys(require.modules);var semVerCandidates=[];var otherCandidates=[];for(var i=0;i<moduleNames.length;i++){var moduleName=moduleNames[i];if(new RegExp(name+"@").test(moduleName)){var version=moduleName.substr(name.length+1);var semVerMatch=versionRegexp.exec(moduleName);if(semVerMatch!=null){semVerCandidates.push({version:version,name:moduleName})}else{otherCandidates.push({version:version,name:moduleName})}}}if(semVerCandidates.concat(otherCandidates).length===0){showError(name)}if(semVerCandidates.length>0){var module=semVerCandidates.sort(require.helper.semVerSort).pop().name;if(returnPath===true){return module}return require(module)}var module=otherCandidates.sort(function(a,b){return a.name>b.name})[0].name;if(returnPath===true){return module}return require(module)};require.modules={};require.register=function(name,definition){require.modules[name]={definition:definition}};require.define=function(name,exports){require.modules[name]={exports:exports}};require.register("tina/src/BoundedPlayable.js",function(exports,module){var Playable=require("tina/src/Playable.js");function BoundedPlayable(){Playable.call(this);this._duration=0;this._iterations=1;this._persist=false;this._pingpong=false;this._onComplete=null}BoundedPlayable.prototype=Object.create(Playable.prototype);BoundedPlayable.prototype.constructor=BoundedPlayable;module.exports=BoundedPlayable;BoundedPlayable.prototype.onComplete=function(onComplete){this._onComplete=onComplete;return this};BoundedPlayable.prototype.getDuration=function(){return this._duration*this._iterations/this._speed};BoundedPlayable.prototype.goToEnd=function(){this.goTo(this.getDuration(),this._iterations-1);return this};BoundedPlayable.prototype.loop=function(){return this.iterations(Infinity)};BoundedPlayable.prototype.iterations=function(iterations){if(iterations<0){console.warn("[BoundedPlayable.iterations] Number of iterations cannot be negative");return this}this._iterations=iterations;return this};BoundedPlayable.prototype.persist=function(persist){this._persist=persist;return this};BoundedPlayable.prototype.pingpong=function(pingpong){this._pingpong=pingpong;return this};BoundedPlayable.prototype._complete=function(overflow){if(this._persist===true){this._startTime+=overflow;return}if(this._player._inactivate(this)===false){return this}if(this._onComplete!==null){this._onComplete(overflow)}};BoundedPlayable.prototype._moveTo=function(time,dt){dt*=this._speed;var overflow;if(this._iterations===1){this._time=(time-this._startTime)*this._speed;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}}else{time=(time-this._startTime)*this._speed;var iteration=time/this._duration;if(dt>0){if(iteration<this._iterations){this._time=time%this._duration}else{overflow=(iteration-this._iterations)*this._duration;dt-=overflow;this._time=this._duration*(1-(Math.ceil(this._iterations)-this._iterations))}}else if(dt<0){if(0<iteration){this._time=time%this._duration}else{overflow=iteration*this._duration;dt-=overflow;this._time=0}}if(this._pingpong===true){if(Math.ceil(this._iterations)===this._iterations){if(overflow===undefined){if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}else{if((Math.ceil(iteration)&1)===1){this._time=this._duration-this._time}}}else{if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}}}this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};BoundedPlayable.prototype._update=function(){}});require.register("tina/src/BoundedPlayer.js",function(exports,module){var BoundedPlayable=require("tina/src/BoundedPlayable.js");var PlayableHandler=require("tina/src/PlayableHandler.js");var inherit=require("tina/src/inherit.js");function BoundedPlayer(){PlayableHandler.call(this);BoundedPlayable.call(this)}BoundedPlayer.prototype=Object.create(BoundedPlayable.prototype);BoundedPlayer.prototype.constructor=BoundedPlayer;inherit(BoundedPlayer,PlayableHandler);module.exports=BoundedPlayer;BoundedPlayer.prototype._delay=function(){this._warn("[BoundedPlayer._delay] This player does not support the delay functionality",this)};BoundedPlayer.prototype._moveTo=function(time,dt){dt*=this._speed;var overflow;if(this._iterations===1){this._time=(time-this._startTime)*this._speed;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}}else{time=(time-this._startTime)*this._speed;var iteration=time/this._duration;if(dt>0){if(iteration<this._iterations){this._time=time%this._duration}else{overflow=(iteration-this._iterations)*this._duration;dt-=overflow;this._time=this._duration*(1-(Math.ceil(this._iterations)-this._iterations))}}else if(dt<0){if(0<iteration){this._time=time%this._duration}else{overflow=iteration*this._duration;dt-=overflow;this._time=0}}if(this._pingpong===true){if(Math.ceil(this._iterations)===this._iterations){if(overflow===undefined){if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}else{if((Math.ceil(iteration)&1)===1){this._time=this._duration-this._time}}}else{if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}}}this._updatePlayableList();this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};BoundedPlayer.prototype._updatePlayableList=function(){}});require.register("tina/src/Delay.js",function(exports,module){var BoundedPlayable=require("tina/src/BoundedPlayable.js");function Delay(duration){if(this instanceof Delay===false){return new Delay(duration)}BoundedPlayable.call(this);this._duration=duration}Delay.prototype=Object.create(BoundedPlayable.prototype);Delay.prototype.constructor=Delay;module.exports=Delay});require.register("tina/src/DoublyList.js",function(exports,module){function ListNode(obj,prev,next,container){this.object=obj;this.prev=prev;this.next=next;this.container=container}function DoublyList(){this.first=null;this.last=null;this.length=0}module.exports=DoublyList;DoublyList.prototype.addFront=function(obj){var newNode=new ListNode(obj,null,this.first,this);if(this.first===null){this.first=newNode;this.last=newNode}else{this.first.prev=newNode;this.first=newNode}this.length+=1;return newNode};DoublyList.prototype.add=DoublyList.prototype.addFront;DoublyList.prototype.addBack=function(obj){var newNode=new ListNode(obj,this.last,null,this);if(this.first===null){this.first=newNode;this.last=newNode}else{this.last.next=newNode;this.last=newNode}this.length+=1;return newNode};DoublyList.prototype.popFront=function(obj){var object=this.first.object;this.remove(this.first);return object};DoublyList.prototype.pop=DoublyList.prototype.popFront;DoublyList.prototype.popBack=function(obj){var object=this.last.object;this.remove(this.last);return object};DoublyList.prototype.remove=function(node){if(node.container!==this){console.warn("[DoublyList.remove] Trying to remove a node that does not belong to the list");return node}if(node.next===null){this.last=node.prev}else{node.next.prev=node.prev}if(node.prev===null){this.first=node.next}else{node.prev.next=node.next}node.container=null;this.length-=1;return null};DoublyList.prototype.clear=function(){for(var node=this.first;node!==null;node=node.next){node.container=null}this.first=null;this.last=null;this.length=0}});require.register("tina/src/easing.js",function(exports,module){var PI=Math.PI;var PI_OVER_TWO=Math.PI/2;var TWO_PI=Math.PI*2;var EXP=2.718281828;exports.none=function(){return 1};exports.linear=function(t){return t};exports.flash=function(t,ease){return t+t*ease-t*t*ease};exports.parabolic=function(t){var r=2*t-1;return 1-r*r};exports.trigo=function(t,n){return.5*(1-Math.cos(TWO_PI*t*n))};exports.elastic=function(t,e){if(t===1)return 1;e=1-1/(e+1);var n=(1+e)*Math.log(1-t)/Math.log(e);return Math.cos(n-PI_OVER_TWO)*Math.pow(e,n)};exports.polyIn=function(t,p){return Math.pow(t,p)};exports.polyOut=function(t,p){return 1-Math.pow((1-t)/1,p)};exports.polyInOut=function(t,p){if(t<.5){return Math.pow(2*t,p)/2}else{return(1+(1-Math.pow(2*(1-t),p)))/2}};exports.sineIn=function(t){return 1-Math.cos(PI_OVER_TWO*t)};exports.sineOut=function(t){return Math.sin(PI_OVER_TWO*t)};exports.sineInOut=function(t){if(t<.5){return(1-Math.cos(PI*t))/2}else{return(1+Math.sin(PI*(t-.5)))/2}};exports.expIn=function(t,e){return(1-Math.pow(EXP,e*t))/(1-Math.pow(EXP,e))};exports.expOut=function(t,e){return(1-Math.pow(EXP,-e*t))/(1-Math.pow(EXP,-e))};exports.expInOut=function(t,e){if(t<.5){return(1-Math.pow(EXP,2*e*t))/(1-Math.pow(EXP,e))/2}else{return.5+(1-Math.pow(EXP,e-2*e*t))/(1-Math.pow(EXP,-e))/2}};exports.circIn=function(t){return 1-Math.sqrt(1-Math.pow(t,2))};exports.circOut=function(t){return Math.sqrt(1-Math.pow(1-t,2))};exports.circInOut=function(t){if(t<.5){return(1-Math.sqrt(1-4*t*t))/2}else{return(1+Math.sqrt(-3+8*t-4*t*t))/2}};exports.elasticIn=function(t,e){if(t===0){return 0}e/=e+1;var n=(1+e)*Math.log(t)/Math.log(e);return Math.cos(n)*Math.pow(e,n)};exports.elasticOut=function(t,e){if(t===1){return 1}e/=e+1;var n=(1+e)*Math.log(1-t)/Math.log(e);return 1-Math.cos(n)*Math.pow(e,n)};exports.elasticInOut=function(t,e){var n;if(t<.5){if(t===0){return 0}e/=e+1;n=(1+e)*Math.log(2*t)/Math.log(e);return.5*Math.cos(n)*Math.pow(e,n)}if(t===1){return 1}e/=e+1;n=(1+e)*Math.log(2-2*t)/Math.log(e);return.5+.5*(1-Math.cos(n)*Math.pow(e,n))};exports.bounceIn=function(t,e){if(t===0){return 0}e/=e+1;var n=(1+e)*Math.log(t)/Math.log(e);return Math.abs(Math.cos(n)*Math.pow(e,n))};exports.bounceOut=function(t,e){if(t===1){return 1}e/=e+1;var n=(1+e)*Math.log(1-t)/Math.log(e);return 1-Math.abs(Math.cos(n)*Math.pow(e,n))};exports.bounceInOut=function(t,e){var n;if(t<.5){if(t===0){return 0}e/=e+1;n=(1+e)*Math.log(2*t)/Math.log(e);return Math.abs(.5*Math.cos(n)*Math.pow(e,n))}if(t===1){return 1}e/=e+1;n=(1+e)*Math.log(2-2*t)/Math.log(e);return.5+.5*(1-Math.abs(Math.cos(n)*Math.pow(e,n)))};exports.backIn=function(t,e){return t*t*((e+1)*t-e)};exports.backOut=function(t,e){t-=1;return t*t*((e+1)*t+e)+1};exports.backInOut=function(t,e){if(t<.5){t*=2;return.5*(t*t*((e+1)*t-e))}t=2*t-2;return.5*(t*t*((e+1)*t+e))+1}});require.register("tina",function(exports,module){var requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}();var clock=window.performance||Date;var TINA={Tweener:require("tina/src/Tweener.js"),Timer:require("tina/src/Timer.js"),Ticker:require("tina/src/Ticker.js"),Playable:require("tina/src/Playable.js"),BoundedPlayable:require("tina/src/BoundedPlayable.js"),PlayableHandler:require("tina/src/PlayableHandler.js"),BoundedPlayer:require("tina/src/BoundedPlayer.js"),Player:require("tina/src/Player.js"),Tween:require("tina/src/Tween.js"),Timeline:require("tina/src/Timeline.js"),Sequence:require("tina/src/Sequence.js"),Recorder:require("tina/src/Recorder.js"),Delay:require("tina/src/Delay.js"),easing:require("tina/src/easing.js"),interpolation:require("tina/src/interpolation.js"),_tweeners:[],_defaultTweener:null,_running:false,_startTime:0,_time:0,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,_pauseOnLostFocus:false,onStart:function(onStart){this._onStart=onStart;return this},onUpdate:function(onUpdate){this._onUpdate=onUpdate;return this},onStop:function(onStop){this._onStop=onStop;return this},onPause:function(onPause){this._onPause=onPause;return this},isRunning:function(){return this._running},update:function(){var now=clock.now()-this._startTime;var dt=now-this._time;if(dt<0){return}this._time=now;var runningTweeners=this._tweeners.slice(0);for(var t=0;t<runningTweeners.length;t+=1){runningTweeners[t]._moveTo(this._time,dt)}if(this._onUpdate!==null){this._onUpdate(this._time,dt)}},reset:function(){this._startTime=clock.now();this._time=0},start:function(){if(this._running===true){console.warn("[TINA.start] TINA is already running");return this}function updateTINA(){if(TINA._running===true){TINA.update();requestAnimFrame(updateTINA)}}if(this._onStart!==null){this._onStart()}this._startTime=clock.now();this._time=0;for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._start()}this._running=true;requestAnimFrame(updateTINA);return this},pause:function(){if(this._running===false){console.warn("[TINA.pause] TINA is not running");return this}this._running=false;for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._pause()}if(this._onPause!==null){this._onPause()}return this},resume:function(){if(this._running===true){console.warn("[TINA.resume] TINA is already running");return this}this._running=true;if(this._onResume!==null){this._onResume()}for(var t=0;t<this._tweeners.length;t+=1){this._tweeners[t]._resume()}var now=clock.now();var dt=now-this._time;this._startTime+=dt;return this},stop:function(){this._running=false;var runningTweeners=this._tweeners.slice(0);for(var t=0;t<runningTweeners.length;t+=1){runningTweeners[t]._stop()}if(this._onStop!==null){this._onStop()}return this},pauseOnLostFocus:function(pauseOnLostFocus){this._pauseOnLostFocus=pauseOnLostFocus;return this},setDefaultTweener:function(tweener){this._defaultTweener=tweener;this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(tweener){if(this._running===false){this.start()}this._tweeners.push(tweener)},add:function(tweener){this._tweeners.push(tweener);return this},_remove:function(tweener){var tweenerIdx=this._tweeners.indexOf(tweener);if(tweenerIdx!==-1){this._tweeners.splice(tweenerIdx,1)}},remove:function(tweener){this._remove(tweener);return this},_getDefaultTweener:function(){if(this._defaultTweener===null){var DefaultTweener=this.Timer;this._defaultTweener=(new DefaultTweener).start()}return this._defaultTweener}};var hidden,visbilityChange;if(typeof document.hidden!=="undefined"){hidden="hidden";visbilityChange="visibilitychange"}else if(typeof document.mozHidden!=="undefined"){hidden="mozHidden";visbilityChange="mozvisibilitychange"}else if(typeof document.msHidden!=="undefined"){hidden="msHidden";visbilityChange="msvisibilitychange"}else if(typeof document.webkitHidden!=="undefined"){hidden="webkitHidden";visbilityChange="webkitvisibilitychange"}if(typeof document[hidden]==="undefined"){this._warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API")}else{var wasRunning=false;document.addEventListener(visbilityChange,function(){if(document[hidden]){wasRunning=TINA.isRunning();if(wasRunning&&TINA._pauseOnLostFocus){TINA.pause()}}if(!document[hidden]){if(wasRunning&&TINA._pauseOnLostFocus){TINA.resume()}}},false)}(function(root){root.TINA=TINA})(this);module.exports=TINA});require.register("tina/src/inherit.js",function(exports,module){module.exports=function(subobject,superobject){var prototypes=Object.keys(superobject.prototype);for(var p=0;p<prototypes.length;p+=1){var prototypeName=prototypes[p];subobject.prototype[prototypeName]=superobject.prototype[prototypeName]}}});require.register("tina/src/interpolation.js",function(exports,module){exports.none=function(t,a,b){return b};exports.linear=function(t,a,b){return a*(1-t)+b*t};exports.discrete=function(t,a,b,d){return Math.floor((a*(1-t)+b*t)/d)*d};exports.vector=function(t,a,b){var c=[];for(var i=0;i<a.length;i+=1){c[i]=a[i]*(1-t)+b[i]*t}return c};exports.state=function(t,a,b,c){var nbStates=b.length+2;var stateIdx=Math.floor(t*nbStates);if(stateIdx<1){return a}if(stateIdx>=nbStates-1){return b}return c[stateIdx-1]};exports.colorRGB=function(t,a,b){return{r:a.r*(1-t)+b.r*t,g:a.g*(1-t)+b.g*t,b:a.b*(1-t)+b.b*t}};exports.colorRGBA=function(t,a,b){return{r:a.r*(1-t)+b.r*t,g:a.g*(1-t)+b.g*t,b:a.b*(1-t)+b.b*t,a:a.a*(1-t)+b.a*t}};exports.colorRGBToHexa=function(t,a,b){var cr=Math.round(a.r*(1-t)+b.r*t);var cg=Math.round(a.g*(1-t)+b.g*t);var cb=Math.round(a.b*(1-t)+b.b*t);return"#"+cr.toString(16)+cg.toString(16)+cb.toString(16)};exports.colorRGBToString=function(t,a,b){var cr=Math.round(a.r*(1-t)+b.r*t);var cg=Math.round(a.g*(1-t)+b.g*t);var cb=Math.round(a.b*(1-t)+b.b*t);return"rgb("+cr.toString(16)+","+cg.toString(16)+","+cb.toString(16)+")"};exports.colorRGBAToString=function(t,a,b){var cr=Math.round(a.r*(1-t)+b.r*t);var cg=Math.round(a.g*(1-t)+b.g*t);var cb=Math.round(a.b*(1-t)+b.b*t);var ca=Math.round(a.a*(1-t)+b.a*t);return"rgba("+cr.toString(16)+","+cg.toString(16)+","+cb.toString(16)+","+ca+")"};exports.string=function(t,a,b){var nbCharsA=a.length;var nbCharsB=b.length;var newString="";for(var c=0;c<nbCharsB;c+=1){var charCodeB=b.charCodeAt(c);var charCodeA=c>=nbCharsA?charCodeB<97?65:97:a.charCodeAt(c);var charCode=Math.round(charCodeA*(1-t)+charCodeB*t);newString+=String.fromCharCode(charCode)}return newString};exports.bezierQuadratic=function(t,a,b,c){var u=1-t;return u*u*a+t*(2*u*c[0]+t*b)};exports.bezierCubic=function(t,a,b,c){var u=1-t;return u*u*u*a+t*(3*u*u*c[0]+t*(3*u*c[1]+t*b))};exports.bezierQuartic=function(t,a,b,c){var u=1-t;var u2=2*u;return u2*u2*a+t*(4*u*u2*c[0]+t*(6*u2*c[1]+t*(4*u*c[2]+t*b)))};exports.bezierQuintic=function(t,a,b,c){var u=1-t;var u2=2*u;return u2*u2*u*a+t*(5*u2*u2*c[0]+t*(10*u*u2*c[1]+t*(10*u2*c[2]+t*(5*u*c[3]+t*b))))};exports.bezier=function(t,a,b,c){var n=c.length;var u=1-t;var x=b;var term=n;for(k=1;k<n;k-=1){x=x*t+term*Math.pow(u,k)*c[n-k];term*=(n-k)/(k+1)}return x*t+a*Math.pow(u,n)};exports.bezier2d=function(t,a,b,c){var n=c.length;var u=1-t;var x=b[0];var y=b[1];var p,q;var term=n;for(var k=1;k<n;k-=1){p=term*Math.pow(u,k);q=c[n-k];x=x*t+p*q[0];y=y*t+p*q[1];term*=(n-k)/(k+1)}p=Math.pow(u,n);return[x*t+a[0]*p,y*t+a[1]*p]};exports.bezier3d=function(t,a,b,c){var n=c.length;var u=1-t;var x=b[0];var y=b[1];var z=b[2];var p,q;var term=n;for(var k=1;k<n;k-=1){p=term*Math.pow(u,k);q=c[n-k];x=x*t+p*q[0];y=y*t+p*q[1];z=z*t+p*q[2];term*=(n-k)/(k+1)}p=Math.pow(u,n);return[x*t+a[0]*p,y*t+a[1]*p,z*t+a[2]*p]};exports.bezierKd=function(t,a,b,c){var n=c.length;var u=1-t;var k=a.length;var res=[];for(var i=0;i<k;i+=1){res[i]=b[i]}var p,q;var term=n;for(var l=1;l<n;l-=1){p=term*Math.pow(u,l);q=c[n-l];for(i=0;i<k;i+=1){res[i]=res[i]*t+p*q[i]}term*=(n-l)/(l+1)}p=Math.pow(u,n);for(i=0;i<k;i+=1){res[i]=res[i]*t+a[i]*p}return res};exports.catmullRom=function(t,a,b,c){if(t===1){return b[b.length-1]}var k=b[0].length;var n=b.length-1;t*=n;var i=Math.floor(t);t-=i;var t2=t*t;var t3=t*t2;var w=-.5*t3+1*t2-.5*t;var x=1.5*t3-2.5*t2+1;var y=-1.5*t3+2*t2+.5*t;var z=.5*t3-.5*t2;var p0=b[Math.max(0,i-1)];var p1=b[i];var p2=b[Math.min(n,i+1)];var p3=b[Math.min(n,i+2)];var res=[];for(var j=0;j<k;j+=1){res[j]=p0[j]*w+p1[j]*x+p2[j]*y+p3[j]*z}return res};exports.noise=function(){var perm=[182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216,182];var grad=[-1,1];return function(t,a,b,p){var amp=2;var per=p.per||1;var frq=p.frq||2;var oct=p.oct||4;var off=p.off||0;var c=0;var x=p.x+off;for(var o=0;o<oct;o+=1){var i=(x|x)&255;var x1=x-(x|x);var x0=1-x1;c+=amp*(x0*x0*x1*(3-2*x0)*grad[perm[i]&1]-x1*x1*x0*(3-2*x1)*grad[perm[i+1]&1]);x*=(x-off)*frq+off;amp*=per}var scale=per===1?1/oct:.5*(1-per)/(1-Math.pow(per,oct));t=t+c*scale;return a*(1-t)+b*t}}();exports.simplex2d=function(){var perm=[182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216,182,235,131,26,88,132,100,117,202,176,10,19,83,243,75,52,252,194,32,30,72,15,124,53,236,183,121,103,175,39,253,120,166,33,237,141,99,180,18,143,69,136,173,21,210,189,16,142,190,130,109,186,104,80,62,51,165,25,122,119,42,219,146,61,149,177,54,158,27,170,60,201,159,193,203,58,154,222,78,138,220,41,98,14,156,31,29,246,81,181,40,161,192,227,35,241,135,150,89,68,134,114,230,123,187,179,67,217,71,218,7,148,228,251,93,8,140,125,73,37,82,28,112,24,174,118,232,137,191,133,147,245,6,172,95,113,185,205,254,116,55,198,57,152,128,233,74,225,34,223,79,111,215,85,200,9,242,12,167,44,20,110,107,126,86,231,234,76,207,102,214,238,221,145,213,64,197,38,168,157,87,92,255,212,49,196,240,90,63,0,77,94,1,108,91,17,224,188,153,250,249,199,127,59,46,184,36,43,209,206,248,4,56,47,226,13,144,22,11,247,70,244,48,97,151,195,96,101,45,66,239,178,171,160,84,65,23,3,211,162,163,50,105,129,155,169,115,5,106,2,208,204,139,229,164,216];var grad=[[1,1],[-1,1],[1,-1],[-1,-1],[1,0],[-1,0],[1,0],[-1,0],[0,1],[0,-1],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]];function dot2D(g,x,y){return g[0]*x+g[1]*y}return function(t,a,b,p){var amp=2;var per=p.per||1;var frq=p.frq||2;var oct=p.oct||4;var off=p.off||{x:0,y:0};var c=c;var x=p.x+off.x;var y=p.y+off.y;for(var o=0;o<oct;o+=1){var n0,n1,n2;var f2=.5*(Math.sqrt(3)-1);var s=(x+y)*f2;var i=Math.floor(x+s);var j=Math.floor(y+s);var g2=(3-Math.sqrt(3))/6;var t=(i+j)*g2;var x0=i-t;var y0=j-t;x0=x-x0;y0=y-y0;var i1,j1;if(x0>y0){i1=1;j1=0}else{i1=0;j1=1}var x1=x0-i1+g2;var y1=y0-j1+g2;var x2=x0-1+2*g2;var y2=y0-1+2*g2;var ii=i&255;var jj=j&255;var t0=.5-x0*x0-y0*y0;var t1=.5-x1*x1-y1*y1;var t2=.5-x2*x2-y2*y2;if(t0<0){n0=0}else{var gi0=perm[ii+perm[jj]]&15;t0*=t0;n0=t0*t0*dot2D(grad[gi0],x0,y0)}if(t1<0){n1=0}else{var gi1=perm[ii+i1+perm[jj+j1]]&15;t1*=t1;n1=t1*t1*dot2D(grad[gi1],x1,y1)}if(t2<0){n2=0}else{var gi2=perm[ii+1+perm[jj+1]]&15;t2*=t2;n2=t2*t2*dot2D(grad[gi2],x2,y2)}c+=amp*70*(n0+n1+n2);x*=(x-off.x)*frq+off.x;y*=(y-off.y)*frq+off.y;amp*=per}var scale=per===1?1/oct:.5*(1-per)/(1-Math.pow(per,oct));t=t+c*scale;return a*(1-t)+b*t}}()});require.register("tina/src/Playable.js",function(exports,module){function Playable(){this._startTime=0;this._time=0;this._speed=1;this._handle=null;this._player=null;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(speed){if(this._player!==null&&this._player._duration!==undefined){console.warn("[Playable.speed] Changing the speed of a playable that is attached to ",this._player," is not recommended")}var dt=this._time-this._startTime;if(speed===0){this._startTime=this._time-dt*this._speed}else{if(this._speed===0){this._startTime=this._time-dt/speed}else{this._startTime=this._time-dt*this._speed/speed}}this._speed=speed}});Object.defineProperty(Playable.prototype,"time",{get:function(){return this._time},set:function(time){if(this._player!==null&&this._player._duration!==undefined){console.warn("[Playable.time] Changing the time of a playable that is attached to ",this._player," is not recommended")}this.goTo(time)}});Playable.prototype.onStart=function(onStart){this._onStart=onStart;return this};Playable.prototype.onUpdate=function(onUpdate){this._onUpdate=onUpdate;return this};Playable.prototype.onStop=function(onStop){this._onStop=onStop;return this};Playable.prototype.onPause=function(onPause){this._onPause=onPause;return this};Playable.prototype.onResume=function(onResume){this._onResume=onResume;return this};Playable.prototype._update=function(){if(this._onUpdate!==null){this._onUpdate()}};Playable.prototype._stop=function(){if(this._onStop!==null){this._onStop()}};Playable.prototype._pause=function(){if(this._onPause!==null){this._onPause()}};Playable.prototype._resume=function(){if(this._onResume!==null){this._onResume()}};Playable.prototype.tweener=function(tweener){this._player=tweener;return this};Playable.prototype.goTo=function(timePosition,iteration){if(this._iterations===1){if(this._speed===0){this._startTime+=this._time-timePosition}else{this._startTime+=(this._time-timePosition)/this._speed}}else{iteration=iteration||0;if(this._speed===0){this._startTime+=this._time-timePosition-iteration*this._duration}else{this._startTime+=(this._time-timePosition-iteration*this._duration)/this._speed}}this._time=timePosition;return this};Playable.prototype.rewind=function(){this.goTo(0,0);return this};Playable.prototype.delay=function(delay){if(this._player===null){this._player=TINA._getDefaultTweener()}this._player._delay(this,delay);return this};Playable.prototype.start=function(timeOffset){var player=this._player;if(player===null){player=TINA._getDefaultTweener()}if(player._add(this)===false){return this}if(timeOffset===undefined||timeOffset===null){timeOffset=0}this._start(player,timeOffset-player._time);return this};Playable.prototype._start=function(player,timeOffset){this._player=player;this._startTime=-timeOffset;if(this._onStart!==null){this._onStart()}};Playable.prototype.stop=function(){if(this._player._inactivate(this)===false){return this}this._stop();return this};Playable.prototype.resume=function(){if(this._player._add(this)===false){return this}this._resume();return this};Playable.prototype.pause=function(){if(this._player._inactivate(this)===false){return this}this._pause();return this};Playable.prototype._moveTo=function(time,dt){dt*=this._speed;var overflow;if(this._iterations===1){this._time=(time-this._startTime)*this._speed;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}}else{time=(time-this._startTime)*this._speed;var iteration=time/this._duration;if(dt>0){if(iteration<this._iterations){this._time=time%this._duration}else{overflow=(iteration-this._iterations)*this._duration;dt-=overflow;this._time=this._duration*(1-(Math.ceil(this._iterations)-this._iterations))}}else if(dt<0){if(0<iteration){this._time=time%this._duration}else{overflow=iteration*this._duration;dt-=overflow;this._time=0}}if(this._pingpong===true){if(Math.ceil(this._iterations)===this._iterations){if(overflow===undefined){if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}else{if((Math.ceil(iteration)&1)===1){this._time=this._duration-this._time}}}else{if((Math.ceil(iteration)&1)===0){this._time=this._duration-this._time}}}}this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};Playable.prototype._update=function(){}});require.register("tina/src/PlayableHandler.js",function(exports,module){var DoublyList=require("tina/src/DoublyList.js");function PlayableHandle(playable){this.playable=playable;this.handle=null}function PlayableHandler(){this._activePlayables=new DoublyList;this._inactivePlayables=new DoublyList;this._playablesToRemove=new DoublyList;this._silent=false;this._debug=false}module.exports=PlayableHandler;PlayableHandler.prototype._add=function(playable){if(playable._handle===null){playable._handle=this._inactivePlayables.add(playable);return true}if(playable._handle.container===this._playablesToRemove){playable._handle=this._playablesToRemove.remove(playable._handle);return true}if(playable._handle.container===this._activePlayables){this._warn("[PlayableHandler._add] Playable is already present, and active");return false}if(playable._handle.container===this._inactivePlayables){this._warn("[PlayableHandler._add] Playable is already present, but inactive (could be starting)");return false}this._warn("[PlayableHandler._add] Playable is used elsewhere");return false};PlayableHandler.prototype._remove=function(playable){if(playable._handle===null){this._warn("[PlayableHandler._remove] Playable is not being used");return false}if(playable._handle.container===this._activePlayables){playable._handle=this._playablesToRemove.add(playable._handle);return true}if(playable._handle.container===this._inactivePlayables){playable._handle=this._inactivePlayables.remove(playable._handle);return true}if(playable._handle.container===this._playablesToRemove){this._warn("[PlayableHandler._remove] Playable is already being removed");return false}this._warn("[PlayableHandler._add] Playable is used elsewhere");return false};PlayableHandler.prototype.possess=function(playable){if(playable._handle===null){return false}return playable._handle.container===this._activePlayables||playable._handle.container===this._inactivePlayables};PlayableHandler.prototype._inactivate=function(playable){this._activePlayables.remove(playable._handle);playable._handle=this._inactivePlayables.add(playable)};PlayableHandler.prototype._handlePlayablesToRemove=function(){while(this._playablesToRemove.length>0){var handle=this._playablesToRemove.pop();var playable=handle.object;playable._handle=this._activePlayables.remove(handle)}};PlayableHandler.prototype.clear=function(){this._handledPlayables.clear();this._activePlayables.clear();this._inactivePlayables.clear();this._playablesToRemove.clear();return this};PlayableHandler.prototype.stop=function(){var handle=this._activePlayables.first;while(handle!==null){var next=handle.next;var playable=handle.object;playable.stop();handle=next}this._handlePlayablesToRemove();this._stop();return this};PlayableHandler.prototype._warn=function(warning){if(this._silent===false){console.warn(warning)}if(this._debug===true){debugger}};PlayableHandler.prototype.silent=function(silent){this._silent=silent; | ||
playable._start(this,-startTime)}}};Timeline.prototype._update=function(dt){for(var handle=this._activePlayables.first;handle!==null;handle=handle.next){var playable=handle.object;playable._moveTo(this._time,dt)}}});require.register("tina/src/Timer.js",function(exports,module){var Tweener=require("tina/src/Tweener.js");var clock=window.performance||Date;function Timer(tups){if(this instanceof Timer===false){return new Timer(tups)}Tweener.call(this);this._tups=tups||1}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(tups){if(tups<0){this._warn("[Timer.tups] tups cannot be negative, stop messing with time.");tups=0}var dt=this._time-this._startTime;if(tups===0){this._startTime=this._time-dt*this._tups}else{if(this._tups===0){this._startTime=this._time-dt/tups}else{this._startTime=this._time-dt*this._tups/tups}}this._tups=tups}});Timer.prototype._getElapsedTime=function(time){return this._tups*(time-this._startTime)/1e3};Timer.prototype._getSingleStepDuration=function(dt){return this._tups*dt/1e3};Timer.prototype.convertToSeconds=function(timeUnits){return timeUnits/this._tups};Timer.prototype.convertToTimeUnits=function(seconds){return seconds*this._tups}});require.register("tina/src/Transition.js",function(exports,module){function update(object,t){var p=this.prop;object[p]=this.from[p]*(1-t)+this.to[p]*t}function updateP(object,t){var q=this.props;for(var i=0;i<this.props.length;i+=1){var p=q[i];object[p]=this.from[p]*(1-t)+this.to[p]*t}}function updateI(object,t){var p=this.prop;object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}function updatePI(object,t){var q=this.props;for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}}function updateE(object,t){t=this.easing(t,this.easingParam);var p=this.prop;object[p]=this.from[p]*(1-t)+this.to[p]*t}function updatePE(object,t){var q=this.props;t=this.easing(t,this.easingParam);for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.from[p]*(1-t)+this.to[p]*t}}function updateIE(object,t){var p=this.prop;object[p]=this.interps[p](this.easing(t,this.easingParam),this.from[p],this.to[p],this.interpParams[p])}function updatePIE(object,t){var q=this.props;t=this.easing(t,this.easingParam);for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}}var updateMethods=[[[update,updateP],[updateI,updatePI]],[[updateE,updatePE],[updateIE,updatePIE]]];function Transition(properties,from,to,start,duration,easing,easingParam,interpolations,interpolationParams){this.start=start;this.end=start+duration;this.duration=duration;this.from=from;this.to=to;var easingFlag;if(easing){easingFlag=1;this.easing=easing;this.easingParam=easingParam}else{easingFlag=0}var interpFlag;if(interpolations===null){interpFlag=0}else{interpFlag=1;this.interps=interpolations;this.interpParams=interpolationParams||{}}var propsFlag;if(properties.length===1){propsFlag=0;this.prop=properties[0]}else{propsFlag=1;this.props=properties}this.update=updateMethods[easingFlag][interpFlag][propsFlag]}module.exports=Transition});require.register("tina/src/TransitionRelative.js",function(exports,module){function update(object,t){var p=this.prop;var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev);this.prev=now}function updateP(object,t){var q=this.props;for(var i=0;i<this.props.length;i+=1){var p=q[i];var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateI(object,t){var p=this.prop;var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev);this.prev=now}function updatePI(object,t){var q=this.properties;for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateE(object,t){t=this.easing(t,this.easingParams);var p=this.prop;var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev);this.prev=now}function updatePE(object,t){var q=this.properties;t=this.easing(t,this.easingParams);for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateIE(object,t){var p=this.prop;var now=this.interps[p](this.easing(t,this.easingParams),this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev);this.prev=now}function updatePIE(object,t){var q=this.properties;t=this.easing(t,this.easingParams);for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}var updateMethods=[[[update,updateP],[updateI,updatePI]],[[updateE,updatePE],[updateIE,updatePIE]]];function Transition(properties,from,to,start,duration,easing,easingParam,interpolations,interpolationParams){this.start=start;this.end=start+duration;this.duration=duration;this.from=from;this.to=to;var easingFlag;if(easing){easingFlag=1;this.easing=easing;this.easingParam=easingParam}else{easingFlag=0}var interpFlag;if(interpolations===null){interpFlag=0}else{interpFlag=1;this.interps=interpolations;this.interpParams=interpolationParams||{}}var propsFlag;if(properties.length===1){propsFlag=0;this.prop=properties[0];this.prev=0}else{propsFlag=1;this.props=properties;this.prev={};for(var p=0;p<properties.length;p+=1){this.prev[properties[p]]=0}}this.update=updateMethods[easingFlag][interpFlag][propsFlag]}module.exports=Transition});require.register("tina/src/Tween.js",function(exports,module){var Playable=require("tina/src/Playable.js");var Transition=require("tina/src/Transition.js");var easingFunctions=require("tina/src/easing.js");var interpolationFunctions=require("tina/src/interpolation.js");function Temporisation(start,duration,toObject){this.start=start;this.end=start+duration;this.duration=duration;this.to=toObject;this.update=function(){}}function Tween(object,properties){if(this instanceof Tween===false){return new Tween(object,properties)}Playable.call(this);this._object=object;if((properties===null||properties===undefined)&&object instanceof Array){properties=[];for(var p=0;p<object.length;p+=1){properties[p]=p}}this._properties=properties;this._from=null;this._interpolations=null;this._current=0;this._transitions=[]}Tween.prototype=Object.create(Playable.prototype);Tween.prototype.constructor=Tween;module.exports=Tween;Tween.prototype.Transition=Transition;Tween.prototype.reset=function(){this._current=0;this._transitions=[];return this};Tween.prototype.interpolations=function(interpolations){for(var p=0;p<this._properties.length;p+=1){var property=this._properties[p];var interpolation=interpolations[property];if(interpolation===undefined){interpolations[property]=interpolationFunctions.linear;continue}if(typeof interpolation==="string"){if(interpolationFunctions[interpolation]===undefined){console.warn("[Tween.interpolations] Given interpolation does not exist");interpolations[property]=interpolationFunctions.linear}else{interpolations[property]=interpolationFunctions[interpolation]}}}this._interpolations=interpolations;return this};Tween.prototype.from=function(fromObject){this._from=fromObject;if(this._transitions.length>0){this._transitions[0].from=fromObject}return this};Tween.prototype._setFrom=function(){this._from={};for(var p=0;p<this._properties.length;p+=1){var property=this._properties[p];this._from[property]=this._object[property]}return this._from};Tween.prototype._getLastTransitionEnding=function(){if(this._transitions.length>0){return this._transitions[this._transitions.length-1].to}else{return this._from===null?this._setFrom():this._from}};Tween.prototype.to=function(duration,toObject,easing,easingParam,interpolationParams){if(typeof easing==="string"){if(easingFunctions[easing]===undefined){console.warn("[Tween.to] Given easing does not exist");easing=undefined}else{easing=easingFunctions[easing]}}var fromObject=this._getLastTransitionEnding();var Transition=this.Transition;var transition=new Transition(this._properties,fromObject,toObject,this._duration,duration,easing,easingParam,this._interpolations,interpolationParams);this._transitions.push(transition);this._duration+=duration;return this};Tween.prototype.wait=function(duration){var toObject=this._getLastTransitionEnding();this._transitions.push(new Temporisation(this._duration,duration,toObject));this._duration+=duration;return this};Tween.prototype._update=function(){var transition=this._transitions[this._current];while(transition.end<=this._time){if(this._current===this._transitions.length-1){transition.update(this._object,1);return}transition=this._transitions[++this._current]}while(this._time<=transition.start){if(this._current===0){transition.update(this._object,0);return}transition=this._transitions[--this._current]}transition.update(this._object,(this._time-transition.start)/transition.duration)}});require.register("tina/src/Tweener.js",function(exports,module){var Player=require("tina/src/Player.js");var Delay=require("tina/src/Delay.js");function Tweener(){Player.call(this);this._duration=Infinity;this._player=TINA}Tweener.prototype=Object.create(Player.prototype);Tweener.prototype.constructor=Tweener;module.exports=Tweener;Tweener.prototype._finish=function(playable){playable._handle=this._playablesToRemove.add(playable._handle)};Tweener.prototype.stop=function(){while(this._activePlayables.length>0){var playable=this._activePlayables.pop();playable._handle=null;playable.stop()}this._handlePlayableToRemove();this._stop();return this};Tweener.prototype._moveTo=function(time,dt){this._time=this._getElapsedTime(time-this._startTime);dt=this._getSingleStepDuration(dt);var overflow;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}this._handlePlayablesToRemove();while(this._inactivePlayables.length>0){playable=this._inactivePlayables.pop();playable._handle=this._activePlayables.add(playable)}for(var handle=this._activePlayables.first;handle!==null;handle=handle.next){handle.object._moveTo(this._time,dt)}if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};Tweener.prototype._delay=function(playable,delay){if(delay<=0){this._warn("[Tweener.add] Delay null or negative ("+delay+")."+"Starting the playable with a delay of 0.");playable.start();return}var delayPlayable=new Delay(delay);delayPlayable.tweener(this).onComplete(function(timeOverflow){playable.start(timeOverflow)}).start()};Tweener.prototype.useAsDefault=function(){TINA.setDefaultTweener(this)}});require.register("tina/src/TweenRelative.js",function(exports,module){var Tween=require("tina/src/Tween.js");var TransitionRelative=require("tina/src/TransitionRelative.js");function TweenRelative(object,properties){if(this instanceof TweenRelative===false){return new TweenRelative(object,properties)}Tween.call(this,object,properties)}TweenRelative.prototype=Object.create(Tween.prototype);TweenRelative.prototype.constructor=TweenRelative;module.exports=TweenRelative;TweenRelative.prototype._setFrom=function(){this._from={};for(var p=0;p<this._properties.length;p+=1){var property=this._properties[p];this._from[property]=0}return this._from};TweenRelative.prototype.Transition=TransitionRelative});require("tina"); | ||
return this};PlayableHandler.prototype.debug=function(debug){this._debug=debug;return this}});require.register("tina/src/Player.js",function(exports,module){var Delay=require("tina/src/Delay.js");var Playable=require("tina/src/Playable.js");var PlayableHandler=require("tina/src/PlayableHandler.js");var inherit=require("tina/src/inherit.js");function Player(){Playable.call(this);PlayableHandler.call(this)}Player.prototype=Object.create(Playable.prototype);Player.prototype.constructor=Player;inherit(Player,PlayableHandler);module.exports=Player;Player.prototype._delay=function(playable,delay){if(delay<=0){this._warn("[Tweener.add] Delay null or negative ("+delay+")."+"Starting the playable with a delay of 0.");playable.start();return}Delay(delay).tweener(this).onComplete(function(timeOverflow){playable.start(timeOverflow)}).start()};Player.prototype._moveTo=function(time,dt){this._time=time-this._startTime;var overflow;if(dt>0){if(this._time>=this._duration){overflow=this._time-this._duration;dt-=overflow;this._time=this._duration}}else if(dt<0){if(this._time<=0){overflow=this._time;dt-=overflow;this._time=0}}this._updatePlayableList();this._update(dt);if(this._onUpdate!==null){this._onUpdate(this._time,dt)}if(overflow!==undefined){this._complete(overflow)}};Player.prototype._updatePlayableList=function(){}});require.register("tina/src/Recorder.js",function(exports,module){var BoundedPlayable=require("tina/src/BoundedPlayable.js");function ObjectRecorder(object,properties,onIn,onOut){this.object=object;this.properties=properties;this.timestamps=[];this.records=[];this.playingHead=1;this.isIn=false;this.onIn=onIn||null;this.onOut=onOut||null}ObjectRecorder.prototype.record=function(time){for(var p=0;p<this.properties.length;p+=1){this.records.push(this.object[this.properties[p]])}this.timestamps.push(time)};ObjectRecorder.prototype.play=function(time,smooth){var nbProperties=this.properties.length;var lastRecord=this.timestamps.length-1;var playingHead=this.playingHead;var isIn=this.timestamps[0]<=time&&time<=this.timestamps[lastRecord];if(isIn===true){if(this.playing===false){this.playing=true;if(this.onIn!==null){this.onIn()}}}else{if(this.playing===true){this.playing=false;if(this.onOut!==null){this.onOut()}}return}while(playingHead<lastRecord&&time<=this.timestamps[playingHead]){playingHead+=1}while(playingHead>1&&time>this.timestamps[playingHead]){playingHead-=1}if(smooth){var t0=this.timestamps[playingHead-1];var t1=this.timestamps[playingHead];var dt=t1-t0;var delta0=(t-t0)/dt;var delta1=(t1-t)/dt;var recordIdx1=nbProperties*playingHead;var recordIdx0=nbProperties*playingHead-nbProperties;for(var p=0;p<nbProperties;p+=1){this.object[this.properties[p]]=this.records[recordIdx0+p]*delta0+this.records[recordIdx1+p]*delta1}}else{var recordIdx=nbProperties*playingHead;for(var p=0;p<nbProperties;p+=1){this.object[this.properties[p]]=this.records[recordIdx+p]}}};function Recorder(){if(this instanceof Recorder===false){return new Recorder}BoundedPlayable.call(this);this._duration=Infinity;this._recordedObjects=[];this._recordingObjects={};this._recordingObjectLabels=[];this._recording=true;this._playing=false;this._smooth=false;this._onStartRecording=null;this._onStopRecording=null;this._onStartPlaying=null;this._onStopPlaying=null}Recorder.prototype=Object.create(BoundedPlayable.prototype);Recorder.prototype.constructor=Recorder;module.exports=Recorder;Recorder.prototype.onStartRecording=function(onStartRecording){this._onStartRecording=onStartRecording;return this};Recorder.prototype.onStopRecording=function(onStopRecording){this._onStopRecording=onStopRecording;return this};Recorder.prototype.onStartPlaying=function(onStartPlaying){this._onStartPlaying=onStartPlaying;return this};Recorder.prototype.onStopPlaying=function(onStopPlaying){this._onStopPlaying=onStopPlaying;return this};Recorder.prototype.reset=function(){this._recordedObjects=[];this._recordingObjects={};this._recordingObjectLabels=[];return this};Recorder.prototype.record=function(label,object,properties,onIn,onOut){var objectRecorder=new ObjectRecorder(object,properties,onIn,onOut);this._recordingObjects[label]=objectRecorder;this._recordedObjects.push(objectRecorder);this._recordingObjectLabels.push(label);return this};Recorder.prototype.stopRecordingObject=function(label){delete this._recordingObjects[label];var labelIdx=this._recordingObjectLabels.indexOf(label);if(labelIdx===-1){console.warn("[Recorder.stopRecordingObject] Trying to stop recording an object that is not being recording:",label);return this}this._recordingObjectLabels.splice(labelIdx,1);return this};Recorder.prototype.removeRecordedObject=function(label){var recorder=this._recordingObjects[label];delete this._recordingObjects[label];var labelIdx=this._recordingObjectLabels.indexOf(label);if(labelIdx!==-1){this._recordingObjectLabels.splice(labelIdx,1)}var recorderIdx=this._recordedObjects.indexOf(recorder);if(recorderIdx===-1){console.warn("[Recorder.removeRecordedObject] Trying to remove an object that was not recorded:",label);return this}this._recordingObjectLabels.splice(recorderIdx,1);return this};Recorder.prototype.recording=function(recording){if(this._recording!==recording){this._recording=recording;if(this._recording===true){if(this._playing===true){if(this._onStopPlaying!==null){this._onStopPlaying()}this._playing=false}if(this._onStartRecording!==null){this._onStartRecording()}}else{if(this._onStopRecording!==null){this._onStopRecording()}}}return this};Recorder.prototype.playing=function(playing){if(this._playing!==playing){this._playing=playing;if(this._playing===true){if(this._recording===true){if(this._onStopRecording!==null){this._onStopRecording()}this._recording=false}if(this._onStartPlaying!==null){this._onStartPlaying()}}else{if(this._onStopPlaying!==null){this._onStopPlaying()}}}return this};Recorder.prototype.smooth=function(smooth){this._smooth=smooth;return this};Recorder.prototype.update=function(){if(this._recording){var nbRecordingObjects=this._recordingObjectLabels.length;for(var r=0;r<nbRecordingObjects;r+=1){var label=this._recordingObjectLabels[r];this._recordingObjects[label].record(this._time)}}if(this._playing){var nbObjectRecorded=this._recordedObjects.length;for(var r=0;r<nbObjectRecorded;r+=1){this._recordedObjects[r].play(this._time,this._smooth)}}}});require.register("tina/src/Sequence.js",function(exports,module){var Timeline=require("tina/src/Timeline.js");function Sequence(){if(this instanceof Sequence===false){return new Sequence}Timeline.call(this)}Sequence.prototype=Object.create(Timeline.prototype);Sequence.prototype.constructor=Sequence;module.exports=Sequence;Sequence.prototype.add=function(playable){playable._startTime=this._duration;this._duration+=playable._duration;this._add(playable);return this};Sequence.prototype.addDelay=function(duration){this._duration+=duration;return this}});require.register("tina/src/Ticker.js",function(exports,module){var Tweener=require("tina/src/Tweener.js");function Ticker(tupt){if(this instanceof Ticker===false){return new Ticker(tupt)}Tweener.call(this);SOmethingElse.call(this);this._tupt=tupt||1;this._nbTicks=0}Ticker.prototype=Object.create(Tweener.prototype);Ticker.prototype.constructor=Ticker;module.exports=Ticker;Object.defineProperty(Ticker.prototype,"tupt",{get:function(){return this._tupt},set:function(tupt){if(tupt<0){this._warn("[Timer.tupt] tupt cannot be negative, stop messing with time.");tupt=0}var dt=this._nbTicks;if(tupt===0){this._nbTicks=this._time-dt*this._tupt}else{if(this._tupt===0){this._nbTicks=this._time-dt/tupt}else{this._nbTicks=this._time-dt*this._tupt/tupt}}this._tupt=tupt}});Ticker.prototype._getElapsedTime=function(){return this._tupt*this._nbTicks++};Ticker.prototype._getSingleStepDuration=function(){return this._tupt};Ticker.prototype.convertToTicks=function(timeUnits){return timeUnits/this._tupt};Ticker.prototype.convertToTimeUnits=function(nbTicks){return nbTicks*this._tupt}});require.register("tina/src/Timeline.js",function(exports,module){var BoundedPlayer=require("tina/src/BoundedPlayer.js");function Timeline(){if(this instanceof Timeline===false){return new Timeline}BoundedPlayer.call(this)}Timeline.prototype=Object.create(BoundedPlayer.prototype);Timeline.prototype.constructor=Timeline;module.exports=Timeline;Timeline.prototype.add=function(startTime,playable){playable._startTime=startTime;this._add(playable);this._duration=Math.max(this._duration,startTime+playable.getDuration());return this};Timeline.prototype._computeDuration=function(){var duration=0;for(var handle=this._inactivePlayables.first;handle!==null;handle=handle.next){var playable=handle.object;duration=Math.max(duration,playable._startTime+playable.getDuration())}for(handle=this._activePlayables.first;handle!==null;handle=handle.next){playable=handle.object;duration=Math.max(duration,playable._startTime+playable.getDuration())}this._duration=duration};Timeline.prototype.remove=function(playable){this._remove(playable);return this};Timeline.prototype._start=function(player,timeOffset){BoundedPlayer.prototype._start.call(this,player,timeOffset);this._computeDuration()};Timeline.prototype._updatePlayableList=function(){this._handlePlayablesToRemove();var handle=this._inactivePlayables.first;while(handle!==null){var playable=handle.object;handle=handle.next;var startTime=playable._startTime;var endTime=startTime+playable.getDuration();if(startTime<=this._time&&this._time<=endTime){this._inactivePlayables.remove(playable._handle);playable._handle=this._activePlayables.add(playable);playable._start(this,-startTime)}}};Timeline.prototype._update=function(dt){for(var handle=this._activePlayables.first;handle!==null;handle=handle.next){var playable=handle.object;playable._moveTo(this._time,dt)}}});require.register("tina/src/Timer.js",function(exports,module){var Tweener=require("tina/src/Tweener.js");var clock=window.performance||Date;function Timer(tups){if(this instanceof Timer===false){return new Timer(tups)}Tweener.call(this);this._tups=tups||1e3}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(tups){if(tups<0){this._warn("[Timer.tups] tups cannot be negative, stop messing with time.");tups=0}var dt=this._time-this._startTime;if(tups===0){this._startTime=this._time-dt*this._tups}else{if(this._tups===0){this._startTime=this._time-dt/tups}else{this._startTime=this._time-dt*this._tups/tups}}this._tups=tups}});Timer.prototype._getElapsedTime=function(time){return this._tups*(time-this._startTime)/1e3};Timer.prototype._getSingleStepDuration=function(dt){return this._tups*dt/1e3};Timer.prototype.convertToSeconds=function(timeUnits){return timeUnits/this._tups};Timer.prototype.convertToTimeUnits=function(seconds){return seconds*this._tups}});require.register("tina/src/Transition.js",function(exports,module){function update(object,t){var p=this.prop;object[p]=this.from[p]*(1-t)+this.to[p]*t}function updateP(object,t){var q=this.props;for(var i=0;i<this.props.length;i+=1){var p=q[i];object[p]=this.from[p]*(1-t)+this.to[p]*t}}function updateI(object,t){var p=this.prop;object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}function updatePI(object,t){var q=this.props;for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}}function updateE(object,t){t=this.easing(t,this.easingParam);var p=this.prop;object[p]=this.from[p]*(1-t)+this.to[p]*t}function updatePE(object,t){var q=this.props;t=this.easing(t,this.easingParam);for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.from[p]*(1-t)+this.to[p]*t}}function updateIE(object,t){var p=this.prop;object[p]=this.interps[p](this.easing(t,this.easingParam),this.from[p],this.to[p],this.interpParams[p])}function updatePIE(object,t){var q=this.props;t=this.easing(t,this.easingParam);for(var i=0;i<q.length;i+=1){var p=q[i];object[p]=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p])}}var updateMethods=[[[update,updateP],[updateI,updatePI]],[[updateE,updatePE],[updateIE,updatePIE]]];function Transition(properties,from,to,start,duration,easing,easingParam,interpolations,interpolationParams){this.start=start;this.end=start+duration;this.duration=duration;this.from=from;this.to=to;var easingFlag;if(easing){easingFlag=1;this.easing=easing;this.easingParam=easingParam}else{easingFlag=0}var interpFlag;if(interpolations===null){interpFlag=0}else{interpFlag=1;this.interps=interpolations;this.interpParams=interpolationParams||{}}var propsFlag;if(properties.length===1){propsFlag=0;this.prop=properties[0]}else{propsFlag=1;this.props=properties}this.update=updateMethods[easingFlag][interpFlag][propsFlag]}module.exports=Transition});require.register("tina/src/TransitionRelative.js",function(exports,module){function update(object,t){var p=this.prop;var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev);this.prev=now}function updateP(object,t){var q=this.props;for(var i=0;i<this.props.length;i+=1){var p=q[i];var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateI(object,t){var p=this.prop;var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev);this.prev=now}function updatePI(object,t){var q=this.properties;for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateE(object,t){t=this.easing(t,this.easingParams);var p=this.prop;var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev);this.prev=now}function updatePE(object,t){var q=this.properties;t=this.easing(t,this.easingParams);for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.from[p]*(1-t)+this.to[p]*t;object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}function updateIE(object,t){var p=this.prop;var now=this.interps[p](this.easing(t,this.easingParams),this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev);this.prev=now}function updatePIE(object,t){var q=this.properties;t=this.easing(t,this.easingParams);for(var i=0;i<q.length;i+=1){var p=q[i];var now=this.interps[p](t,this.from[p],this.to[p],this.interpParams[p]);object[p]=object[p]+(now-this.prev[p]);this.prev[p]=now}}var updateMethods=[[[update,updateP],[updateI,updatePI]],[[updateE,updatePE],[updateIE,updatePIE]]];function Transition(properties,from,to,start,duration,easing,easingParam,interpolations,interpolationParams){this.start=start;this.end=start+duration;this.duration=duration;this.from=from;this.to=to;var easingFlag;if(easing){easingFlag=1;this.easing=easing;this.easingParam=easingParam}else{easingFlag=0}var interpFlag;if(interpolations===null){interpFlag=0}else{interpFlag=1;this.interps=interpolations;this.interpParams=interpolationParams||{}}var propsFlag;if(properties.length===1){propsFlag=0;this.prop=properties[0];this.prev=0}else{propsFlag=1;this.props=properties;this.prev={};for(var p=0;p<properties.length;p+=1){this.prev[properties[p]]=0}}this.update=updateMethods[easingFlag][interpFlag][propsFlag]}module.exports=Transition});require.register("tina/src/Tween.js",function(exports,module){var BoundedPlayable=require("tina/src/BoundedPlayable.js");var Transition=require("tina/src/Transition.js");var TransitionRelative=require("tina/src/TransitionRelative.js");var easingFunctions=require("tina/src/easing.js");var interpolationFunctions=require("tina/src/interpolation.js");function Temporisation(start,duration,toObject){this.start=start;this.end=start+duration;this.duration=duration;this.to=toObject;this.update=function(){}}function Tween(object,properties){if(this instanceof Tween===false){return new Tween(object,properties)}BoundedPlayable.call(this);this._object=object;if((properties===null||properties===undefined)&&object instanceof Array){properties=[];for(var p=0;p<object.length;p+=1){properties[p]=p}}this._properties=properties;this._from=null;this._interpolations=null;this._current=0;this._transitions=[]}Tween.prototype=Object.create(BoundedPlayable.prototype);Tween.prototype.constructor=Tween;module.exports=Tween;Tween.prototype.relative=function(relative){this._relative=relative;return this};Tween.prototype.reset=function(){this._current=0;this._transitions=[];return this};Tween.prototype.interpolations=function(interpolations){for(var p=0;p<this._properties.length;p+=1){var property=this._properties[p];var interpolation=interpolations[property];if(interpolation===undefined){interpolations[property]=interpolationFunctions.linear;continue}if(typeof interpolation==="string"){if(interpolationFunctions[interpolation]===undefined){console.warn("[Tween.interpolations] Given interpolation does not exist");interpolations[property]=interpolationFunctions.linear}else{interpolations[property]=interpolationFunctions[interpolation]}}}this._interpolations=interpolations;return this};Tween.prototype.from=function(fromObject){this._from=fromObject;if(this._transitions.length>0){this._transitions[0].from=fromObject}return this};Tween.prototype._setFrom=function(){this._from={};for(var p=0;p<this._properties.length;p+=1){var property=this._properties[p];this._from[property]=this._relative?0:this._object[property]}return this._from};Tween.prototype._getLastTransitionEnding=function(){if(this._transitions.length>0){return this._transitions[this._transitions.length-1].to}else{return this._from===null?this._setFrom():this._from}};Tween.prototype.to=function(toObject,duration,easing,easingParam,interpolationParams){if(typeof easing==="string"){if(easingFunctions[easing]===undefined){console.warn("[Tween.to] Given easing does not exist");easing=undefined}else{easing=easingFunctions[easing]}}var fromObject=this._getLastTransitionEnding();var TransitionConstructor=this._relative===true?TransitionRelative:Transition;var transition=new TransitionConstructor(this._properties,fromObject,toObject,this._duration,duration,easing,easingParam,this._interpolations,interpolationParams);this._transitions.push(transition);this._duration+=duration;return this};Tween.prototype.wait=function(duration){var toObject=this._getLastTransitionEnding();this._transitions.push(new Temporisation(this._duration,duration,toObject));this._duration+=duration;return this};Tween.prototype._update=function(){var transition=this._transitions[this._current];while(transition.end<=this._time){if(this._current===this._transitions.length-1){transition.update(this._object,1);return}transition=this._transitions[++this._current]}while(this._time<=transition.start){if(this._current===0){transition.update(this._object,0);return}transition=this._transitions[--this._current]}transition.update(this._object,(this._time-transition.start)/transition.duration)}});require.register("tina/src/Tweener.js",function(exports,module){var Player=require("tina/src/Player.js");function Tweener(){Player.call(this);this._player=TINA}Tweener.prototype=Object.create(Player.prototype);Tweener.prototype.constructor=Tweener;module.exports=Tweener;Tweener.prototype._inactivate=function(playable){playable._handle=this._playablesToRemove.add(playable._handle)};Tweener.prototype._moveTo=function(time,dt){this._time=this._getElapsedTime(time-this._startTime);dt=this._getSingleStepDuration(dt);this._handlePlayablesToRemove();while(this._inactivePlayables.length>0){playable=this._inactivePlayables.pop();playable._handle=this._activePlayables.add(playable)}for(var handle=this._activePlayables.first;handle!==null;handle=handle.next){handle.object._moveTo(this._time,dt)}if(this._onUpdate!==null){this._onUpdate(this._time,dt)}};Tweener.prototype.useAsDefault=function(){TINA.setDefaultTweener(this);return this}});require("tina"); |
{ | ||
"name": "tina", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "Tweening and INterpolations for Animation", | ||
"main": "src/index.js", | ||
"scripts": [ | ||
"src/BoundedPlayable.js", | ||
"src/BoundedPlayer.js", | ||
"src/Delay.js", | ||
@@ -11,4 +13,6 @@ "src/DoublyList.js", | ||
"src/index.js", | ||
"src/inherit.js", | ||
"src/interpolation.js", | ||
"src/Playable.js", | ||
"src/PlayableHandler.js", | ||
"src/Player.js", | ||
@@ -23,4 +27,3 @@ "src/Recorder.js", | ||
"src/Tween.js", | ||
"src/Tweener.js", | ||
"src/TweenRelative.js" | ||
"src/Tweener.js" | ||
], | ||
@@ -27,0 +30,0 @@ "repository": { |
{ | ||
"name": "tina", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "Tweening and INterpolations for Animation", | ||
@@ -14,9 +14,11 @@ "main": "src/index.js", | ||
"keywords": [ | ||
"Tweening", | ||
"Interpolation", | ||
"Easing", | ||
"Animation", | ||
"Timeline", | ||
"Sequence", | ||
"Recorder" | ||
"tween", | ||
"tweening", | ||
"animation", | ||
"easing", | ||
"interpolation", | ||
"animation", | ||
"timeline", | ||
"sequence", | ||
"recorder" | ||
], | ||
@@ -23,0 +25,0 @@ "author": "bchevalier", |
@@ -8,18 +8,16 @@ # TINA | ||
Animation library to easily create customisable tweens, timelines, sequences and other playable components. | ||
Javascript Animation Library to easily create customisable tweens, timelines, sequences and other playable components. | ||
* **Easy to use**, friendly API | ||
* **Easy to use**, friendly API (strongly inspired by Tweenjs) | ||
* **High performance** | ||
* **Easy to debug** | ||
* **High performance** | ||
* **Open source** and MIT License | ||
* **Open source** and MIT License (use it as you please) | ||
* A consequent library of **easing and interpolation methods** | ||
* A variety of components such as **Timeline**, **Sequence** and **Recorder** | ||
* A variety of components such as **Timeline** and **Sequence** (**Recorder** coming soon) | ||
* **High flexibility** (tween parameters can easily be modified after creation and even when they are running) | ||
* **Running options**: delay, iterations, persist (speed, and pingpong coming soon) | ||
* **Running options**: delay, iterations, pingpong, persist and speed. | ||
* **High customizability** (possibility to use custom easing and interpolation functions and playable components) | ||
* **Good synchronisation** between tweens | ||
* Possibility to alter objects while they are tweening (enabled by relative tweening) | ||
* No rounding errors on classical tweens (the last property value is guaranteed to be reached) | ||
* Managed loss of focus of the page (user changes tab or minimise the application) | ||
* Creation and removal of tweens within the callback of another tween will not result in any unwanted side effect | ||
* **Relative tweening** enables the possibility to alter objects while they are tweening | ||
* Bonus: Creation and removal of tweens within the callback of another tween will not result in any unwanted side effect | ||
@@ -44,5 +42,5 @@ ## How to use | ||
var propertiesToTween = ['x']; | ||
var duration = 2; // in seconds | ||
var duration = 500; // in milliseconds | ||
var myTween = new TINA.Tween(myObject, propertiesToTween) | ||
.to(duration, { x: 1 }) | ||
.to({ x: 1 }, duration) | ||
.start(); | ||
@@ -54,3 +52,3 @@ ``` | ||
TINA.Tween(myObject, ['x']) | ||
.to(duration, { x: 1 }) | ||
.to({ x: 1 }, duration) | ||
.start(); | ||
@@ -63,3 +61,3 @@ ``` | ||
var myTween = new TINA.Tween(myArray) | ||
.to(duration, [0, 2, 1]) | ||
.to([0, 2, 1], duration) | ||
.start(); | ||
@@ -71,3 +69,3 @@ ``` | ||
var myTween = new TINA.Tween(myObject, ['x', 'y']) | ||
.to(duration, { x: 1, y: 0 }) | ||
.to({ x: 1, y: 0 }, duration) | ||
.start(); | ||
@@ -79,4 +77,4 @@ ``` | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(duration1, { x: 1 }) | ||
.to(duration2, { x: 2 }) | ||
.to({ x: 1 }, duration1) | ||
.to({ x: 2 }, duration2) | ||
.start(); | ||
@@ -91,7 +89,7 @@ ``` | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(duration, { x: 1 }, 'elasticInOut', easingParameter) | ||
.to({ x: 1 }, duration, 'elasticInOut', easingParameter) | ||
.start(); | ||
// or | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(duration, { x: 1 }, TINA.easing.elasticInOut, easingParameter) | ||
.to({ x: 1 }, duration, TINA.easing.elasticInOut, easingParameter) | ||
.start(); | ||
@@ -105,3 +103,3 @@ ``` | ||
var myTween = new TINA.Tween(myObject, ['abc']) | ||
.to(duration, { abc: 'World' }) | ||
.to({ abc: 'World' }, duration) | ||
.interpolations({ abc: 'string' }) | ||
@@ -111,3 +109,3 @@ .start(); | ||
var myTween = new TINA.Tween(myObject, ['abc']) | ||
.to(duration, { abc: 'World' }) | ||
.to({ abc: 'World' }, duration) | ||
.interpolations({ abc: TINA.interpolation.string }) | ||
@@ -119,3 +117,5 @@ .start(); | ||
``` javascript | ||
var myTween = new TINA.Tween(myObject, ['x']).to(duration, { x: 1 }).delay(1); | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to({ x: 1 }, duration) | ||
.delay(1000); | ||
``` | ||
@@ -126,3 +126,3 @@ | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(duration, { x: 1 }) | ||
.to({ x: 1 }, duration) | ||
.onStart(function () { | ||
@@ -137,3 +137,3 @@ console.log('Tweening will now start'); | ||
}) | ||
.delay(1); | ||
.delay(1000); | ||
``` | ||
@@ -146,3 +146,3 @@ | ||
var timePosTweenA = 0; | ||
var timePosTweenB = 2; | ||
var timePosTweenB = 2000; | ||
var myTimeline = new TINA.Timeline() | ||
@@ -179,3 +179,3 @@ .add(timePosTweenA, myTweenA) | ||
var myParticle = new Particle(); | ||
var myDelay = new TINA.Delay(duration) | ||
Delay(duration) | ||
.onUpdate(function (time, dt) { | ||
@@ -185,3 +185,3 @@ myParticle.x += particleSpeedX * dt; | ||
particleSpeedX *= Math.pow(0.9, dt); | ||
particleSpeedX *= Math.pow(0.95, dt); | ||
particleSpeedY += gravity * dt; | ||
@@ -191,3 +191,4 @@ }) | ||
myParticle.destroy() | ||
}); | ||
}) | ||
.start(); | ||
``` | ||
@@ -204,3 +205,3 @@ | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(1, { x: 5 }) | ||
.to({ x: 5 }, 1000) | ||
.start(); | ||
@@ -213,3 +214,3 @@ ``` | ||
var myTween = new TINA.Tween(myObject, ['x']) | ||
.to(1, { x: 5 }) | ||
.to({ x: 5 }, 1000) | ||
.tweener(myTweener) | ||
@@ -223,4 +224,4 @@ .start(); | ||
var myTimer = new TINA.Timer().useAsDefault(); | ||
// myTween will be attached to myTimer and will take 0.5 seconds to tween | ||
var myTween = new TINA.Tween(myObject, ['x']).to(0.5, { x: 5 }).start(); | ||
// myTween will be attached to myTimer and will take 500 milliseconds to tween | ||
var myTween = new TINA.Tween(myObject, ['x']).to({ x: 5 }, 500).start(); | ||
``` | ||
@@ -250,5 +251,5 @@ | ||
This flexbility allows the user to use units that he is comfortable with. | ||
It could be ```1 unit per second```, ```24 u/s```, ```60 u/s``` or ```1000 u/s``` (or even ```237.6 u/s``` if you come from another planet). | ||
It could be ```1 unit per second```, ```24 ups```, ```60 ups``` or ```1000 ups``` (or even ```237.6 ups``` if you come from another planet). | ||
By default the timer goes at a speed of 1 unit per second. | ||
By default the timer goes at a speed of 1000 units per second (milliseconds). | ||
Every second, the time will increase by the given ```tups```: | ||
@@ -266,10 +267,10 @@ ``` javascript | ||
// The following will tween myObject in 10 seconds | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTimer1); | ||
// The following will tween myObject in 100 seconds | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTimer1); | ||
// The following will tween myObject in 1 / 6 seconds | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTimer60); | ||
// The following will tween myObject in 1.667 seconds | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTimer60); | ||
// The following will tween myObject in 0.01 seconds | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTimer1000); | ||
// The following will tween myObject in 0.1 seconds | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTimer1000); | ||
``` | ||
@@ -307,14 +308,14 @@ | ||
``` javascript | ||
var myTicker01 = new TINA.Ticker(0.1); | ||
var myTicker1 = new TINA.Ticker(1); | ||
var myTicker10 = new TINA.Ticker(10); | ||
var myTicker20 = new TINA.Ticker(20); | ||
// The following will tween myObject in 100 updates | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTicker01); | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTicker1); | ||
// The following will tween myObject in 10 updates | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTicker1); | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTicker10); | ||
// The following will tween myObject in 1 update | ||
TINA.Tween(myObject, ['x']).to(10, { x: 1 }).tweener(myTicker10); | ||
// The following will tween myObject in 5 updates | ||
TINA.Tween(myObject, ['x']).to({ x: 1 }, 100).tweener(myTicker20); | ||
``` | ||
@@ -326,3 +327,3 @@ | ||
// t is the total time elapsed since TINA started | ||
// dt is the time elapsed since the previous update of TINA | ||
// dt is the time elapsed since the TINA's previous update | ||
// both durations are in milliseconds | ||
@@ -329,0 +330,0 @@ TINA.onUpdate(function (t, dt) { |
@@ -1,2 +0,2 @@ | ||
var Playable = require('./Playable'); | ||
var BoundedPlayable = require('./BoundedPlayable'); | ||
@@ -13,7 +13,7 @@ /** | ||
Playable.call(this); | ||
BoundedPlayable.call(this); | ||
this._duration = duration; | ||
} | ||
Delay.prototype = Object.create(Playable.prototype); | ||
Delay.prototype = Object.create(BoundedPlayable.prototype); | ||
Delay.prototype.constructor = Delay; | ||
module.exports = Delay; |
@@ -35,17 +35,17 @@ | ||
var TINA = { | ||
Tweener: require('./Tweener'), | ||
Timer: require('./Timer'), | ||
Ticker: require('./Ticker'), | ||
Playable: require('./Playable'), | ||
Player: require('./Player'), | ||
// Controller: require('./Controller'), // TODO | ||
Tween: require('./Tween'), | ||
// Warning: Using relative tweens can lead to rounding errors (very small). | ||
TweenRelative: require('./TweenRelative'), | ||
Timeline: require('./Timeline'), | ||
Sequence: require('./Sequence'), | ||
Recorder: require('./Recorder'), | ||
Delay: require('./Delay'), | ||
easing: require('./easing'), | ||
interpolation: require('./interpolation'), | ||
Tweener: require('./Tweener'), | ||
Timer: require('./Timer'), | ||
Ticker: require('./Ticker'), | ||
Playable: require('./Playable'), | ||
BoundedPlayable: require('./BoundedPlayable'), | ||
PlayableHandler: require('./PlayableHandler'), | ||
BoundedPlayer: require('./BoundedPlayer'), | ||
Player: require('./Player'), | ||
Tween: require('./Tween'), | ||
Timeline: require('./Timeline'), | ||
Sequence: require('./Sequence'), | ||
Recorder: require('./Recorder'), | ||
Delay: require('./Delay'), | ||
easing: require('./easing'), | ||
interpolation: require('./interpolation'), | ||
@@ -66,2 +66,4 @@ _tweeners: [], | ||
_pauseOnLostFocus: false, | ||
onStart: function (onStart) { | ||
@@ -131,7 +133,6 @@ this._onStart = onStart; | ||
var self = this; | ||
var selfUpdate = function () { | ||
if (self._running === true) { | ||
self.update(); | ||
requestAnimFrame(selfUpdate); | ||
function updateTINA() { | ||
if (TINA._running === true) { | ||
TINA.update(); | ||
requestAnimFrame(updateTINA); | ||
} | ||
@@ -155,3 +156,3 @@ } | ||
// Starting the animation loop | ||
requestAnimFrame(selfUpdate); | ||
requestAnimFrame(updateTINA); | ||
return this; | ||
@@ -217,2 +218,7 @@ }, | ||
pauseOnLostFocus: function (pauseOnLostFocus) { | ||
this._pauseOnLostFocus = pauseOnLostFocus; | ||
return this; | ||
}, | ||
setDefaultTweener: function (tweener) { | ||
@@ -256,13 +262,7 @@ this._defaultTweener = tweener; | ||
if (this._defaultTweener === null) { | ||
// If a default tweener is required but non exist | ||
// Then it is started in addition to being created | ||
var DefaultTweener = this.Timer; | ||
this._defaultTweener = new DefaultTweener().start(); | ||
} | ||
// else { | ||
// // Is the default tweener running? | ||
// var idx = this._tweeners.indexOf(this._defaultTweener); | ||
// if (idx === -1) { | ||
// // Not running, starting it | ||
// this._defaultTweener.start(); | ||
// } | ||
// } | ||
@@ -301,3 +301,3 @@ return this._defaultTweener; | ||
wasRunning = TINA.isRunning(); | ||
if (wasRunning) { | ||
if (wasRunning && TINA._pauseOnLostFocus) { | ||
TINA.pause(); | ||
@@ -309,3 +309,3 @@ } | ||
// document is back (we missed you buddy) | ||
if (wasRunning) { | ||
if (wasRunning && TINA._pauseOnLostFocus) { | ||
// Running TINA only if it was running when the document focus was lost | ||
@@ -312,0 +312,0 @@ TINA.resume(); |
@@ -80,2 +80,10 @@ /** | ||
exports.colorRGBToString = function(t, a, b) { | ||
var cr = Math.round(a.r * (1 - t) + b.r * t); | ||
var cg = Math.round(a.g * (1 - t) + b.g * t); | ||
var cb = Math.round(a.b * (1 - t) + b.b * t); | ||
return 'rgb(' + cr.toString(16) + ',' + cg.toString(16) + ',' + cb.toString(16) + ')'; | ||
}; | ||
exports.colorRGBAToString = function(t, a, b) { | ||
@@ -90,3 +98,3 @@ var cr = Math.round(a.r * (1 - t) + b.r * t); | ||
// Interpolation between 2 strings a and b | ||
// Interpolation between 2 strings a and b (yes that's possible) | ||
// Returns a string of the same size as b | ||
@@ -113,3 +121,2 @@ exports.string = function(t, a, b) { | ||
// TODO: introduce c = control points | ||
// Bezier, c = array of control points in ]-Inf, +Inf[ | ||
@@ -116,0 +123,0 @@ exports.bezierQuadratic = function(t, a, b, c) { |
@@ -5,5 +5,3 @@ /** @class */ | ||
this._time = 0; | ||
this._duration = 0; | ||
this._iterations = 1; | ||
this._persist = false; | ||
this._speed = 1; | ||
@@ -13,2 +11,3 @@ this._handle = null; | ||
// Callbacks | ||
this._onStart = null; | ||
@@ -19,45 +18,45 @@ this._onPause = null; | ||
this._onStop = null; | ||
this._onComplete = null; | ||
}; | ||
module.exports = Playable; | ||
Playable.prototype.tweener = function (tweener) { | ||
this._player = tweener; | ||
return this; | ||
}; | ||
Object.defineProperty(Playable.prototype, 'speed', { | ||
get: function () { return this._speed; }, | ||
set: function (speed) { | ||
if ((this._player !== null) && (this._player._duration !== undefined)) { | ||
console.warn('[Playable.speed] Changing the speed of a playable that is attached to ', this._player, ' is not recommended'); | ||
} | ||
Playable.prototype.getDuration = function () { | ||
return this._duration; | ||
}; | ||
var dt = this._time - this._startTime; | ||
if (speed === 0) { | ||
// Setting timeStart as if new speed was 1 | ||
this._startTime = this._time - dt * this._speed; | ||
} else { | ||
if (this._speed === 0) { | ||
// If current speed is 0, | ||
// it corresponds to a virtual speed of 1 | ||
// when it comes to determing where the starting time is | ||
this._startTime = this._time - dt / speed; | ||
} else { | ||
this._startTime = this._time - dt * this._speed / speed; | ||
} | ||
} | ||
Playable.prototype.goTo = function (time) { | ||
// Offsetting start time with respect to current time | ||
this._startTime = this._time - time; | ||
return this; | ||
}; | ||
this._speed = speed; | ||
} | ||
}); | ||
Playable.prototype.goToBeginning = function () { | ||
this.goTo(0); | ||
return this; | ||
}; | ||
Object.defineProperty(Playable.prototype, 'time', { | ||
get: function () { return this._time; }, | ||
set: function (time) { | ||
if ((this._player !== null) && (this._player._duration !== undefined)) { | ||
console.warn('[Playable.time] Changing the time of a playable that is attached to ', this._player, ' is not recommended'); | ||
} | ||
Playable.prototype.goToEnd = function () { | ||
this.goTo(this.getDuration()); | ||
return this; | ||
}; | ||
this.goTo(time); | ||
} | ||
}); | ||
Playable.prototype.iterations = function (iterations) { | ||
this._iterations = iterations; | ||
return this; | ||
}; | ||
Playable.prototype.persist = function (persist) { | ||
this._persist = persist; | ||
return this; | ||
}; | ||
Playable.prototype.onStart = function (onStart) { this._onStart = onStart; return this; }; | ||
Playable.prototype.onUpdate = function (onUpdate) { this._onUpdate = onUpdate; return this; }; | ||
Playable.prototype.onStop = function (onStop) { this._onStop = onStop; return this; }; | ||
Playable.prototype.onComplete = function (onComplete) { this._onComplete = onComplete; return this; }; | ||
Playable.prototype.onPause = function (onPause) { this._onPause = onPause; return this; }; | ||
@@ -71,2 +70,39 @@ Playable.prototype.onResume = function (onResume) { this._onResume = onResume; return this; }; | ||
Playable.prototype.tweener = function (tweener) { | ||
this._player = tweener; | ||
return this; | ||
}; | ||
Playable.prototype.goTo = function (timePosition, iteration) { | ||
if (this._iterations === 1) { | ||
if(this._speed === 0) { | ||
// Speed is virtually 1 | ||
this._startTime += this._time - timePosition; | ||
} else { | ||
// Offsetting starting time with respect to current time and speed | ||
this._startTime += (this._time - timePosition) / this._speed; | ||
} | ||
} else { | ||
iteration = iteration || 0; | ||
if(this._speed === 0) { | ||
// Speed is virtually 1 | ||
this._startTime += this._time - timePosition - iteration * this._duration; | ||
} else { | ||
// Offsetting starting time with respect to current time and speed | ||
this._startTime += (this._time - timePosition - iteration * this._duration) / this._speed; | ||
} | ||
} | ||
this._time = timePosition; | ||
// iteration = iteration || 0; | ||
// // Offsetting start time with respect to current time and given iteration | ||
// this._startTime = this._time - time - iteration * this._duration; | ||
return this; | ||
}; | ||
Playable.prototype.rewind = function () { | ||
this.goTo(0, 0); | ||
return this; | ||
}; | ||
Playable.prototype.delay = function (delay) { | ||
@@ -76,3 +112,3 @@ if (this._player === null) { | ||
} | ||
// TODO: add _delay method to TINA | ||
this._player._delay(this, delay); | ||
@@ -101,3 +137,2 @@ return this; | ||
Playable.prototype._start = function (player, timeOffset) { | ||
@@ -114,3 +149,3 @@ this._player = player; | ||
// Stopping playable without performing any additional update nor completing | ||
if (this._player._finish(this) === false) { | ||
if (this._player._inactivate(this) === false) { | ||
// Could not be stopped | ||
@@ -135,3 +170,3 @@ return this; | ||
Playable.prototype.pause = function () { | ||
if (this._player._finish(this) === false) { | ||
if (this._player._inactivate(this) === false) { | ||
// Could not be paused | ||
@@ -145,24 +180,6 @@ return this; | ||
Playable.prototype._complete = function (overflow) { | ||
if (this._persist === true) { | ||
// Playable is persisting | ||
// i.e it never completes | ||
this._startTime += overflow; | ||
return; | ||
} | ||
// Removing playable before it completes | ||
// So that the playable can be started again within _onComplete callback | ||
if (this._player._finish(this) === false) { | ||
// Could not be completed | ||
return this; | ||
} | ||
Playable.prototype._moveTo = function (time, dt) { | ||
dt *= this._speed; | ||
if (this._onComplete !== null) { | ||
this._onComplete(overflow); | ||
} | ||
}; | ||
Playable.prototype._moveTo = function (time, dt) { | ||
// Computing overflow and clamping time | ||
@@ -172,3 +189,3 @@ var overflow; | ||
// Converting into time relative to when the playable was started | ||
this._time = time - this._startTime; | ||
this._time = (time - this._startTime) * this._speed; | ||
if (dt > 0) { | ||
@@ -188,3 +205,3 @@ if (this._time >= this._duration) { | ||
} else { | ||
time = (time - this._startTime); | ||
time = (time - this._startTime) * this._speed; | ||
@@ -200,3 +217,3 @@ // Iteration at current update | ||
dt -= overflow; | ||
this._time = this._duration; | ||
this._time = this._duration * (1 - (Math.ceil(this._iterations) - this._iterations)); | ||
} | ||
@@ -212,2 +229,20 @@ } else if (dt < 0) { | ||
} | ||
if ((this._pingpong === true)) { | ||
if (Math.ceil(this._iterations) === this._iterations) { | ||
if (overflow === undefined) { | ||
if ((Math.ceil(iteration) & 1) === 0) { | ||
this._time = this._duration - this._time; | ||
} | ||
} else { | ||
if ((Math.ceil(iteration) & 1) === 1) { | ||
this._time = this._duration - this._time; | ||
} | ||
} | ||
} else { | ||
if ((Math.ceil(iteration) & 1) === 0) { | ||
this._time = this._duration - this._time; | ||
} | ||
} | ||
} | ||
} | ||
@@ -226,33 +261,3 @@ | ||
// Playable.prototype._moveToward = function (dt) { | ||
// this._time += dt; | ||
// // Computing overflow and clamping time | ||
// var overflow; | ||
// if (dt > 0) { | ||
// if (this._time >= this._duration) { | ||
// overflow = this._time - this._duration; | ||
// dt -= overflow; | ||
// this._time = this._duration; | ||
// } | ||
// } else if (dt < 0) { | ||
// if (this._time <= 0) { | ||
// overflow = this._time; | ||
// dt -= overflow; | ||
// this._time = 0; | ||
// } | ||
// } | ||
// this._update(dt); | ||
// if (this._onUpdate !== null) { | ||
// this._onUpdate(this._time, dt); | ||
// } | ||
// if (overflow !== undefined) { | ||
// this._complete(overflow); | ||
// } | ||
// }; | ||
// Overridable method | ||
Playable.prototype._update = function () {}; |
@@ -1,8 +0,6 @@ | ||
var DoublyList = require('./DoublyList'); | ||
var Playable = require('./Playable'); | ||
var Delay = require('./Delay'); | ||
var Playable = require('./Playable'); | ||
var PlayableHandler = require('./PlayableHandler'); | ||
function PlayableHandle(playable) { | ||
this.playable = playable; | ||
this.handle = null; | ||
} | ||
var inherit = require('./inherit'); | ||
@@ -15,29 +13,23 @@ /** | ||
Playable.call(this); | ||
// A DoublyList, rather than an Array, is used to store playables. | ||
// It allows for faster removal and is similar in speed for iterations. | ||
// Quick note: as of mid 2014 iterating through linked list was slower than iterating through arrays | ||
// in safari and firefox as only V8 managed to have linked lists work as fast as arrays. | ||
// As of mid 2015 it seems that performances are now identical in every major browsers. | ||
// (KUDOs to the JS engines guys) | ||
// List of active playables handled by this player | ||
this._activePlayables = new DoublyList(); | ||
// List of inactive playables handled by this player | ||
this._inactivePlayables = new DoublyList(); | ||
// List of playables that are not handled by this player anymore and are waiting to be removed | ||
this._playablesToRemove = new DoublyList(); | ||
// Whether to silence warnings | ||
this._silent = false; | ||
// Whether to trigger the debugger on warnings | ||
this._debug = false; | ||
PlayableHandler.call(this); | ||
} | ||
Player.prototype = Object.create(Playable.prototype); | ||
Player.prototype.constructor = Player; | ||
inherit(Player, PlayableHandler); | ||
module.exports = Player; | ||
Player.prototype._delay = function (playable, delay) { | ||
if (delay <= 0) { | ||
this._warn('[Tweener.add] Delay null or negative (' + delay + ').' + | ||
'Starting the playable with a delay of 0.'); | ||
playable.start(); | ||
return; | ||
} | ||
Delay(delay).tweener(this).onComplete(function (timeOverflow) { | ||
playable.start(timeOverflow); | ||
}).start(); | ||
}; | ||
Player.prototype._moveTo = function (time, dt) { | ||
@@ -74,135 +66,3 @@ this._time = time - this._startTime; | ||
Player.prototype._add = function (playable) { | ||
if (playable._handle === null) { | ||
// Playable can be added | ||
playable._handle = this._inactivePlayables.add(playable); | ||
return true; | ||
} | ||
// Playable is already handled, either by this player or by another one | ||
if (playable._handle.container === this._playablesToRemove) { | ||
// Playable was being removed, removing from playables to remove | ||
playable._handle = this._playablesToRemove.remove(playable._handle); | ||
return true; | ||
} | ||
if (playable._handle.container === this._activePlayables) { | ||
this._warn('[Player._add] Playable is already present, and active'); | ||
return false; | ||
} | ||
if (playable._handle.container === this._inactivePlayables) { | ||
this._warn('[Player._add] Playable is already present, but inactive (could be starting)'); | ||
return false; | ||
} | ||
this._warn('[Player._add] Playable is used elsewhere'); | ||
return false; | ||
}; | ||
Player.prototype._remove = function (playable) { | ||
if (playable._handle === null) { | ||
this._warn('[Player._remove] Playable is not being used'); | ||
return false; | ||
} | ||
// Playable is handled, either by this player or by another one | ||
if (playable._handle.container === this._activePlayables) { | ||
// Playable was active, adding to remove list | ||
playable._handle = this._playablesToRemove.add(playable._handle); | ||
return true; | ||
} | ||
if (playable._handle.container === this._inactivePlayables) { | ||
// Playable was being started, removing from starting playables | ||
playable._handle = this._inactivePlayables.remove(playable._handle); | ||
return true; | ||
} | ||
if (playable._handle.container === this._playablesToRemove) { | ||
this._warn('[Player._remove] Playable is already being removed'); | ||
return false; | ||
} | ||
this._warn('[Player._add] Playable is used elsewhere'); | ||
return false; | ||
}; | ||
Player.prototype.possess = function (playable) { | ||
if (playable._handle === null) { | ||
return false; | ||
} | ||
return (playable._handle.container === this._activePlayables) || (playable._handle.container === this._inactivePlayables); | ||
}; | ||
Player.prototype._finish = function (playable) { | ||
this._activePlayables.remove(playable._handle); | ||
// Playable is moved to the list of inactive playables | ||
playable._handle = this._inactivePlayables.add(playable); | ||
}; | ||
Player.prototype._handlePlayablesToRemove = function () { | ||
while (this._playablesToRemove.length > 0) { | ||
// O(1) where O stands for "Oh yeah" | ||
// Removing from list of playables to remove | ||
var handle = this._playablesToRemove.pop(); | ||
// Removing from list of active playables | ||
var playable = handle.object; | ||
playable._handle = this._activePlayables.remove(handle); | ||
} | ||
}; | ||
// Overridable method | ||
Player.prototype._updatePlayableList = function () {}; | ||
Player.prototype.clear = function () { | ||
this._handledPlayables.clear(); | ||
this._activePlayables.clear(); | ||
this._inactivePlayables.clear(); | ||
this._playablesToRemove.clear(); | ||
return this; | ||
}; | ||
Player.prototype.stop = function () { | ||
// Stopping all active playables | ||
var handle = this._activePlayables.first; | ||
while (handle !== null) { | ||
var next = handle.next; | ||
var playable = handle.object; | ||
playable.stop(); | ||
handle = next; | ||
} | ||
this._handlePlayableToRemove(); | ||
this._stop(); | ||
return this; | ||
}; | ||
Player.prototype._delay = function () { | ||
this._warn('[Player._delay] This player does not support the delay functionality'); | ||
}; | ||
Player.prototype._warn = function (warning) { | ||
if (this._silent === false) { | ||
console.warn(warning); | ||
} | ||
if (this._debug === true) { | ||
debugger; | ||
} | ||
}; | ||
Player.prototype.silent = function (silent) { | ||
this._silent = silent; | ||
return this; | ||
}; | ||
Player.prototype.debug = function (debug) { | ||
this._debug = debug; | ||
return this; | ||
}; |
@@ -1,4 +0,4 @@ | ||
var Playable = require('./Playable'); | ||
var BoundedPlayable = require('./BoundedPlayable'); | ||
function ObjectRecorder(object, properties) { | ||
function ObjectRecorder(object, properties, onIn, onOut) { | ||
this.object = object; | ||
@@ -9,2 +9,8 @@ this.properties = properties; | ||
this.playingHead = 1; | ||
// Whether or not the playing head is within the recording duration | ||
this.isIn = false; | ||
this.onIn = onIn || null; | ||
this.onOut = onOut || null; | ||
} | ||
@@ -25,2 +31,20 @@ | ||
var isIn = (this.timestamps[0] <= time) && (time <= this.timestamps[lastRecord]); | ||
if (isIn === true) { | ||
if (this.playing === false) { | ||
this.playing = true; | ||
if (this.onIn !== null) { | ||
this.onIn(); | ||
} | ||
} | ||
} else { | ||
if (this.playing === true) { | ||
this.playing = false; | ||
if (this.onOut !== null) { | ||
this.onOut(); | ||
} | ||
} | ||
return; | ||
} | ||
while ((playingHead < lastRecord) && (time <= this.timestamps[playingHead])) { | ||
@@ -71,10 +95,17 @@ playingHead += 1; | ||
Playable.call(this); | ||
BoundedPlayable.call(this); | ||
// Never ends | ||
// Can end only in playing mode | ||
// TODO: set starting time and duration when switching to playing mode | ||
this._duration = Infinity; | ||
// List of objects and properties to records | ||
this._objectRecorders = []; | ||
// List of objects and properties recorded | ||
this._recordedObjects = []; | ||
// List of objects and properties recording | ||
this._recordingObjects = {}; | ||
// List of object labels | ||
this._recordingObjectLabels = []; | ||
// Whether the recorder is in recording mode | ||
@@ -88,32 +119,97 @@ this._recording = true; | ||
this._smooth = false; | ||
this._onStartRecording = null; | ||
this._onStopRecording = null; | ||
this._onStartPlaying = null; | ||
this._onStopPlaying = null; | ||
} | ||
Recorder.prototype = Object.create(Playable.prototype); | ||
Recorder.prototype = Object.create(BoundedPlayable.prototype); | ||
Recorder.prototype.constructor = Recorder; | ||
module.exports = Recorder; | ||
Recorder.prototype.onStartRecording = function (onStartRecording) { | ||
this._onStartRecording = onStartRecording; | ||
return this; | ||
}; | ||
Recorder.prototype.onStopRecording = function (onStopRecording) { | ||
this._onStopRecording = onStopRecording; | ||
return this; | ||
}; | ||
Recorder.prototype.onStartPlaying = function (onStartPlaying) { | ||
this._onStartPlaying = onStartPlaying; | ||
return this; | ||
}; | ||
Recorder.prototype.onStopPlaying = function (onStopPlaying) { | ||
this._onStopPlaying = onStopPlaying; | ||
return this; | ||
}; | ||
Recorder.prototype.reset = function () { | ||
this._objectRecorders = []; | ||
this._recordedObjects = []; | ||
this._recordingObjects = {}; | ||
this._recordingObjectLabels = []; | ||
return this; | ||
}; | ||
Recorder.prototype.record = function (object, properties) { | ||
this._objectRecorders.push(new ObjectRecorder(object, properties)); | ||
Recorder.prototype.record = function (label, object, properties, onIn, onOut) { | ||
var objectRecorder = new ObjectRecorder(object, properties, onIn, onOut); | ||
this._recordingObjects[label] = objectRecorder; | ||
this._recordedObjects.push(objectRecorder); | ||
this._recordingObjectLabels.push(label); | ||
return this; | ||
}; | ||
Recorder.prototype.remove = function (object) { | ||
var nbObjectRecorders = this._objectRecorders.length; | ||
for (var r = 0; r < nbObjectRecorders; r += 1) { | ||
if (this._objectRecorders[r].object === object) { | ||
this._objectRecorders.splice(1, r); | ||
break; | ||
} | ||
Recorder.prototype.stopRecordingObject = function (label) { | ||
delete this._recordingObjects[label]; | ||
var labelIdx = this._recordingObjectLabels.indexOf(label); | ||
if (labelIdx === -1) { | ||
console.warn('[Recorder.stopRecordingObject] Trying to stop recording an object that is not being recording:', label); | ||
return this; | ||
} | ||
this._recordingObjectLabels.splice(labelIdx, 1); | ||
return this; | ||
}; | ||
Recorder.prototype.removeRecordedObject = function (label) { | ||
var recorder = this._recordingObjects[label]; | ||
delete this._recordingObjects[label]; | ||
var labelIdx = this._recordingObjectLabels.indexOf(label); | ||
if (labelIdx !== -1) { | ||
this._recordingObjectLabels.splice(labelIdx, 1); | ||
} | ||
var recorderIdx = this._recordedObjects.indexOf(recorder); | ||
if (recorderIdx === -1) { | ||
console.warn('[Recorder.removeRecordedObject] Trying to remove an object that was not recorded:', label); | ||
return this; | ||
} | ||
this._recordingObjectLabels.splice(recorderIdx, 1); | ||
return this; | ||
}; | ||
Recorder.prototype.recording = function (recording) { | ||
this._recording = recordingMode; | ||
if (this._recording === true) { | ||
this._playing = false; | ||
if (this._recording !== recording) { | ||
this._recording = recording; | ||
if (this._recording === true) { | ||
if (this._playing === true) { | ||
if (this._onStopPlaying !== null) { | ||
this._onStopPlaying(); | ||
} | ||
this._playing = false; | ||
} | ||
if (this._onStartRecording !== null) { | ||
this._onStartRecording(); | ||
} | ||
} else { | ||
if (this._onStopRecording !== null) { | ||
this._onStopRecording(); | ||
} | ||
} | ||
} | ||
@@ -124,5 +220,20 @@ return this; | ||
Recorder.prototype.playing = function (playing) { | ||
this._playing = playingMode; | ||
if (this._playing === true) { | ||
this._recording = false; | ||
if (this._playing !== playing) { | ||
this._playing = playing; | ||
if (this._playing === true) { | ||
if (this._recording === true) { | ||
if (this._onStopRecording !== null) { | ||
this._onStopRecording(); | ||
} | ||
this._recording = false; | ||
} | ||
if (this._onStartPlaying !== null) { | ||
this._onStartPlaying(); | ||
} | ||
} else { | ||
if (this._onStopPlaying !== null) { | ||
this._onStopPlaying(); | ||
} | ||
} | ||
} | ||
@@ -137,7 +248,8 @@ return this; | ||
Recorder.prototype.update = function (dt) { | ||
Recorder.prototype.update = function () { | ||
if (this._recording) { | ||
var nbObjectRecorders = this._objectRecorders.length; | ||
for (var r = 0; r < nbObjectRecorders; r += 1) { | ||
this._objectRecorders[r].record(this._time); | ||
var nbRecordingObjects = this._recordingObjectLabels.length; | ||
for (var r = 0; r < nbRecordingObjects; r += 1) { | ||
var label = this._recordingObjectLabels[r]; | ||
this._recordingObjects[label].record(this._time); | ||
} | ||
@@ -147,7 +259,7 @@ } | ||
if (this._playing) { | ||
var nbObjectRecorders = this._objectRecorders.length; | ||
for (var r = 0; r < nbObjectRecorders; r += 1) { | ||
this._objectRecorders[r].play(this._time, this._smooth); | ||
var nbObjectRecorded = this._recordedObjects.length; | ||
for (var r = 0; r < nbObjectRecorded; r += 1) { | ||
this._recordedObjects[r].play(this._time, this._smooth); | ||
} | ||
} | ||
}; |
@@ -16,2 +16,3 @@ var Tweener = require('./Tweener'); | ||
Tweener.call(this); | ||
SOmethingElse.call(this); | ||
@@ -18,0 +19,0 @@ // Time units per tick (tupt) |
@@ -1,2 +0,2 @@ | ||
var Player = require('./Player'); | ||
var BoundedPlayer = require('./BoundedPlayer'); | ||
@@ -20,5 +20,5 @@ /** | ||
Player.call(this); | ||
BoundedPlayer.call(this); | ||
} | ||
Timeline.prototype = Object.create(Player.prototype); | ||
Timeline.prototype = Object.create(BoundedPlayer.prototype); | ||
Timeline.prototype.constructor = Timeline; | ||
@@ -30,3 +30,3 @@ module.exports = Timeline; | ||
this._add(playable); | ||
this._duration = Math.max(this._duration, startTime + playable._duration); | ||
this._duration = Math.max(this._duration, startTime + playable.getDuration()); | ||
return this; | ||
@@ -39,3 +39,3 @@ }; | ||
var playable = handle.object; | ||
duration = Math.max(duration, playable._startTime + playable._duration); | ||
duration = Math.max(duration, playable._startTime + playable.getDuration()); | ||
} | ||
@@ -45,3 +45,3 @@ | ||
playable = handle.object; | ||
duration = Math.max(duration, playable._startTime + playable._duration); | ||
duration = Math.max(duration, playable._startTime + playable.getDuration()); | ||
} | ||
@@ -58,3 +58,3 @@ | ||
Timeline.prototype._start = function (player, timeOffset) { | ||
Player.prototype._start.call(this, player, timeOffset); | ||
BoundedPlayer.prototype._start.call(this, player, timeOffset); | ||
@@ -77,3 +77,3 @@ // Computing duration of the timeline | ||
var startTime = playable._startTime; | ||
var endTime = startTime + playable._duration; | ||
var endTime = startTime + playable.getDuration(); | ||
if (startTime <= this._time && this._time <= endTime) { | ||
@@ -80,0 +80,0 @@ // O(1) |
@@ -22,3 +22,3 @@ var Tweener = require('./Tweener'); | ||
// Every second, 'tups' time units elapse | ||
this._tups = tups || 1; | ||
this._tups = tups || 1000; | ||
} | ||
@@ -25,0 +25,0 @@ Timer.prototype = Object.create(Tweener.prototype); |
@@ -1,3 +0,4 @@ | ||
var Playable = require('./Playable'); | ||
var Transition = require('./Transition'); | ||
var BoundedPlayable = require('./BoundedPlayable'); | ||
var Transition = require('./Transition'); | ||
var TransitionRelative = require('./TransitionRelative'); | ||
@@ -34,3 +35,3 @@ var easingFunctions = require('./easing'); | ||
Playable.call(this); | ||
BoundedPlayable.call(this); | ||
@@ -64,8 +65,13 @@ // Tweened object | ||
this._transitions = []; | ||
// Whether the tween is relative | ||
} | ||
Tween.prototype = Object.create(Playable.prototype); | ||
Tween.prototype = Object.create(BoundedPlayable.prototype); | ||
Tween.prototype.constructor = Tween; | ||
module.exports = Tween; | ||
Tween.prototype.Transition = Transition; | ||
Tween.prototype.relative = function (relative) { | ||
this._relative = relative; | ||
return this; | ||
}; | ||
@@ -120,3 +126,3 @@ Tween.prototype.reset = function () { | ||
var property = this._properties[p]; | ||
this._from[property] = this._object[property]; | ||
this._from[property] = (this._relative) ? 0 : this._object[property]; | ||
} | ||
@@ -135,3 +141,3 @@ | ||
Tween.prototype.to = function (duration, toObject, easing, easingParam, interpolationParams) { | ||
Tween.prototype.to = function (toObject, duration, easing, easingParam, interpolationParams) { | ||
// The API allows to pass interpolation names that will be replaced | ||
@@ -152,4 +158,4 @@ // by the corresponding interpolation functions | ||
var Transition = this.Transition; | ||
var transition = new Transition( | ||
var TransitionConstructor = (this._relative === true) ? TransitionRelative : Transition; | ||
var transition = new TransitionConstructor( | ||
this._properties, | ||
@@ -156,0 +162,0 @@ fromObject, |
var Player = require('./Player'); | ||
var Delay = require('./Delay'); | ||
@@ -11,5 +10,2 @@ /** | ||
// A tweener has no end and never completes | ||
this._duration = Infinity; | ||
// TINA is the player for all the tweeners | ||
@@ -22,3 +18,3 @@ this._player = TINA; | ||
Tweener.prototype._finish = function (playable) { | ||
Tweener.prototype._inactivate = function (playable) { | ||
// In a tweener, a playable that finishes is simply removed | ||
@@ -28,15 +24,15 @@ playable._handle = this._playablesToRemove.add(playable._handle); | ||
Tweener.prototype.stop = function () { | ||
// Stopping all active playables and removing them right away | ||
while (this._activePlayables.length > 0) { | ||
var playable = this._activePlayables.pop(); | ||
playable._handle = null; | ||
playable.stop(); | ||
} | ||
// Tweener.prototype.stop = function () { | ||
// // Stopping all active playables and removing them right away | ||
// while (this._activePlayables.length > 0) { | ||
// var playable = this._activePlayables.pop(); | ||
// playable._handle = null; | ||
// playable._stop(); | ||
// } | ||
this._handlePlayableToRemove(); | ||
// this._handlePlayablesToRemove(); | ||
this._stop(); | ||
return this; | ||
}; | ||
// this._stop(); | ||
// return this; | ||
// }; | ||
@@ -47,17 +43,17 @@ Tweener.prototype._moveTo = function (time, dt) { | ||
// Computing time overflow and clamping time | ||
var overflow; | ||
if (dt > 0) { | ||
if (this._time >= this._duration) { | ||
overflow = this._time - this._duration; | ||
dt -= overflow; | ||
this._time = this._duration; | ||
} | ||
} else if (dt < 0) { | ||
if (this._time <= 0) { | ||
overflow = this._time; | ||
dt -= overflow; | ||
this._time = 0; | ||
} | ||
} | ||
// // Computing time overflow and clamping time | ||
// var overflow; | ||
// if (dt > 0) { | ||
// if (this._time >= this._duration) { | ||
// overflow = this._time - this._duration; | ||
// dt -= overflow; | ||
// this._time = this._duration; | ||
// } | ||
// } else if (dt < 0) { | ||
// if (this._time <= 0) { | ||
// overflow = this._time; | ||
// dt -= overflow; | ||
// this._time = 0; | ||
// } | ||
// } | ||
@@ -80,24 +76,7 @@ this._handlePlayablesToRemove(); | ||
} | ||
if (overflow !== undefined) { | ||
this._complete(overflow); | ||
} | ||
}; | ||
Tweener.prototype._delay = function (playable, delay) { | ||
if (delay <= 0) { | ||
this._warn('[Tweener.add] Delay null or negative (' + delay + ').' + | ||
'Starting the playable with a delay of 0.'); | ||
playable.start(); | ||
return; | ||
} | ||
var delayPlayable = new Delay(delay); | ||
delayPlayable.tweener(this).onComplete(function (timeOverflow) { | ||
playable.start(timeOverflow); | ||
}).start(); | ||
}; | ||
Tweener.prototype.useAsDefault = function () { | ||
TINA.setDefaultTweener(this); | ||
return this; | ||
}; |
Sorry, the diff of this file is too big to display
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
230316
27
5332
331