parallaxis/duo/js/TimelineMax.min.js

44 lines
16 KiB
JavaScript
Executable File

/*!
* VERSION: beta 1.641
* DATE: 2012-11-08
* JavaScript (ActionScript 3 and 2 also available)
* UPDATES AND DOCS AT: http://www.greensock.com
*
* Copyright (c) 2008-2013, GreenSock. All rights reserved.
* This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
(window._gsQueue||(window._gsQueue=[])).push(function(){_gsDefine("TimelineMax",["TimelineLite","TweenLite","easing.Ease"],function(h,p,f){var g=function(d){h.call(this,d);this._repeat=this.vars.repeat||0;this._repeatDelay=this.vars.repeatDelay||0;this._cycle=0;this._yoyo=!0==this.vars.yoyo;this._dirty=!0},q=[],s=new f(null,null,1,0),f=g.prototype=new h;f.constructor=g;f.kill()._gc=!1;g.version=1.641;f.invalidate=function(){this._yoyo=!0===this.vars.yoyo;this._repeat=this.vars.repeat||0;this._repeatDelay=
this.vars.repeatDelay||0;this._uncache(!0);return h.prototype.invalidate.call(this)};f.addCallback=function(d,c,a,e){return this.insert(p.delayedCall(0,d,a,e),c)};f.removeCallback=function(d,c){if(null==c)this._kill(null,d);else for(var a=this.getTweensOf(d,!1),e=a.length,b=this._parseTimeOrLabel(c);-1<--e;)a[e]._startTime===b&&a[e]._enabled(!1,!1);return this};f.tweenTo=function(d,c){var c=c||{},a={ease:s,overwrite:2,useFrames:this.usesFrames(),immediateRender:!1},e,b;for(e in c)a[e]=c[e];a.time=
this._parseTimeOrLabel(d);b=new p(this,Math.abs(Number(a.time)-this._time)/this._timeScale||0.001,a);a.onStart=function(){b.target.paused(!0);b.vars.time!==b.target.time()&&b.duration(Math.abs(b.vars.time-b.target.time())/b.target._timeScale);c.onStart&&c.onStart.apply(c.onStartScope||b,c.onStartParams||q)};return b};f.tweenFromTo=function(d,c,a){a=a||{};a.startAt={time:this._parseTimeOrLabel(d)};d=this.tweenTo(c,a);return d.duration(Math.abs(d.vars.time-d.vars.startAt.time)/this._timeScale||0.001)};
f.render=function(d,c,a){this._gc&&this._enabled(!0,!1);this._active=!this._paused;var e=!this._dirty?this._totalDuration:this.totalDuration(),b=this._time,j=this._totalTime,i=this._startTime,f=this._timeScale,n=this._rawPrevTime,m=this._paused,k=this._cycle,g,l;if(d>=e){this._locked||(this._totalTime=e,this._cycle=this._repeat);if(!this._reversed&&!this._hasPausedChild()&&(g=!0,l="onComplete",0===this._duration&&(0===d||0>this._rawPrevTime)))this._rawPrevTime!==d&&(a=!0);this._rawPrevTime=d;this._yoyo&&
0!==(this._cycle&1)?(this._time=0,d=-1E-6):(this._time=this._duration,d=this._duration+1E-6)}else if(0>=d){this._locked||(this._totalTime=this._cycle=0);this._time=0;if(0!==b||0===this._duration&&0<this._rawPrevTime&&!this._locked)l="onReverseComplete",g=this._reversed;0>d?(this._active=!1,0===this._duration&&0<=this._rawPrevTime&&(a=!0)):this._initted||(a=!0);this._rawPrevTime=d;d=0===this._duration?0:-1E-6}else if(this._time=this._rawPrevTime=d,!this._locked&&(this._totalTime=d,0!==this._repeat)){var r=
this._duration+this._repeatDelay;this._cycle=this._totalTime/r>>0;0!==this._cycle&&this._cycle===this._totalTime/r&&this._cycle--;this._time=this._totalTime-this._cycle*r;this._yoyo&&0!==(this._cycle&1)&&(this._time=this._duration-this._time);this._time>this._duration?(this._time=this._duration,d=this._duration+1E-6):0>this._time?this._time=d=0:d=this._time}if(this._cycle!==k&&!this._locked){var r=this._yoyo&&0!==(k&1),h=r===(this._yoyo&&0!==(this._cycle&1)),p=this._totalTime,s=this._cycle,u=this._rawPrevTime,
v=this._time;this._totalTime=k*this._duration;this._cycle<k?r=!r:this._totalTime+=this._duration;this._time=b;this._rawPrevTime=0===this._duration?n-1E-5:n;this._cycle=k;this._locked=!0;b=r?0:this._duration;this.render(b,c,0===this._duration);c||this._gc||this.vars.onRepeat&&this.vars.onRepeat.apply(this.vars.onRepeatScope||this,this.vars.onRepeatParams||q);h&&(b=r?this._duration+1E-6:-1E-6,this.render(b,!0,!1));this._time=v;this._totalTime=p;this._cycle=s;this._rawPrevTime=u;this._locked=!1}if(this._time===
b&&!a)j!==this._totalTime&&this._onUpdate&&(c||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||q));else{this._initted||(this._initted=!0);0===j&&this.vars.onStart&&0!==this._totalTime&&(c||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||q));if(this._time>b)for(a=this._first;a;){j=a._next;if(this._paused&&!m)break;else if(a._active||a._startTime<=this._time&&!a._paused&&!a._gc)a._reversed?a.render((!a._dirty?a._totalDuration:a.totalDuration())-
(d-a._startTime)*a._timeScale,c,!1):a.render((d-a._startTime)*a._timeScale,c,!1);a=j}else for(a=this._last;a;){j=a._prev;if(this._paused&&!m)break;else if(a._active||a._startTime<=b&&!a._paused&&!a._gc)a._reversed?a.render((!a._dirty?a._totalDuration:a.totalDuration())-(d-a._startTime)*a._timeScale,c,!1):a.render((d-a._startTime)*a._timeScale,c,!1);a=j}this._onUpdate&&(c||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||q));if(l&&!this._locked&&!this._gc&&(i===this._startTime||
f!==this._timeScale))if(0===this._time||e>=this.totalDuration())g&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),c||this.vars[l]&&this.vars[l].apply(this.vars[l+"Scope"]||this,this.vars[l+"Params"]||q)}};f.getActive=function(d,c,a){null==d&&(d=!0);null==c&&(c=!0);null==a&&(a=!1);var e=[],d=this.getChildren(d,c,a),c=0,a=d.length,b,j;for(b=0;b<a;b++)if(j=d[b],!j._paused&&j._timeline._time>=j._startTime&&j._timeline._time<j._startTime+j._totalDuration/j._timeScale){var i;
a:{for(i=j._timeline;i;){if(i._paused){i=!0;break a}i=i._timeline}i=!1}i||(e[c++]=j)}return e};f.getLabelAfter=function(d){!d&&0!==d&&(d=this._time);var c=this.getLabelsArray(),a=c.length,e;for(e=0;e<a;e++)if(c[e].time>d)return c[e].name;return null};f.getLabelBefore=function(d){null==d&&(d=this._time);for(var c=this.getLabelsArray(),a=c.length;-1<--a;)if(c[a].time<d)return c[a].name;return null};f.getLabelsArray=function(){var d=[],c=0,a;for(a in this._labels)d[c++]={time:this._labels[a],name:a};
d.sort(function(a,b){return a.time-b.time});return d};f.progress=function(d){return!arguments.length?this._time/this.duration():this.totalTime(this.duration()*(this._yoyo&&0!==(this._cycle&1)?1-d:d)+this._cycle*(this._duration+this._repeatDelay),!1)};f.totalProgress=function(d){return!arguments.length?this._totalTime/this.totalDuration():this.totalTime(this.totalDuration()*d,!1)};f.totalDuration=function(d){return!arguments.length?(this._dirty&&(h.prototype.totalDuration.call(this),this._totalDuration=
-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat),this._totalDuration):-1===this._repeat?this:this.duration((d-this._repeat*this._repeatDelay)/(this._repeat+1))};f.time=function(d,c){if(!arguments.length)return this._time;this._dirty&&this.totalDuration();d>this._duration&&(d=this._duration);this._yoyo&&0!==(this._cycle&1)?d=this._duration-d+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(d+=this._cycle*(this._duration+this._repeatDelay));
return this.totalTime(d,c)};f.repeat=function(d){if(!arguments.length)return this._repeat;this._repeat=d;return this._uncache(!0)};f.repeatDelay=function(d){if(!arguments.length)return this._repeatDelay;this._repeatDelay=d;return this._uncache(!0)};f.yoyo=function(d){if(!arguments.length)return this._yoyo;this._yoyo=d;return this};f.currentLabel=function(d){return!arguments.length?this.getLabelBefore(this._time+1E-8):this.seek(d,!0)};return g},!0);_gsDefine("TimelineLite",["core.Animation","core.SimpleTimeline",
"TweenLite"],function(h,p,f){var g=function(a){p.call(this,a);this._labels={};this.autoRemoveChildren=!0==this.vars.autoRemoveChildren;this.smoothChildTiming=!0==this.vars.smoothChildTiming;this._sortChildren=!0;this._onUpdate=this.vars.onUpdate;for(var a=q.length,e,b;-1<--a;)if(b=this.vars[q[a]])for(e=b.length;-1<--e;)"{self}"===b[e]&&(b=this.vars[q[a]]=b.concat(),b[e]=this);this.vars.tweens instanceof Array&&this.insertMultiple(this.vars.tweens,0,this.vars.align||"normal",this.vars.stagger||0)},
q=["onStartParams","onUpdateParams","onCompleteParams","onReverseCompleteParams","onRepeatParams"],s=[],d=function(a){var e={},b;for(b in a)e[b]=a[b];return e},c=g.prototype=new p;g.version=1.641;c.constructor=g;c.kill()._gc=!1;c.to=function(a,e,b,c,d){return this.insert(new f(a,e,b),this._parseTimeOrLabel(d,c,!0))};c.from=function(a,e,b,c,d){return this.insert(f.from(a,e,b),this._parseTimeOrLabel(d,c,!0))};c.fromTo=function(a,e,b,c,d,t){return this.insert(f.fromTo(a,e,b,c),this._parseTimeOrLabel(t,
d,!0))};c.staggerTo=function(a,e,b,c,i,t,n,m,k){n=new g({onComplete:n,onCompleteParams:m,onCompleteScope:k});c=c||0;for(m=0;m<a.length;m++)null!=b.startAt&&(b.startAt=d(b.startAt)),n.insert(new f(a[m],e,d(b)),m*c);return this.insert(n,this._parseTimeOrLabel(t,i,!0))};c.staggerFrom=function(a,e,b,c,d,f,n,g,k){null==b.immediateRender&&(b.immediateRender=!0);b.runBackwards=!0;return this.staggerTo(a,e,b,c,d,f,n,g,k)};c.staggerFromTo=function(a,e,b,c,d,f,g,m,k,h){c.startAt=b;b.immediateRender&&(c.immediateRender=
!0);return this.staggerTo(a,e,c,d,f,g,m,k,h)};c.call=function(a,e,b,c,d){return this.insert(f.delayedCall(0,a,e,b),this._parseTimeOrLabel(d,c,!0))};c.set=function(a,e,b,c){e.immediateRender=!1;return this.insert(new f(a,0,e),this._parseTimeOrLabel(c,b,!0))};g.exportRoot=function(a,e){a=a||{};null==a.smoothChildTiming&&(a.smoothChildTiming=!0);var b=new g(a),c=b._timeline;null==e&&(e=!0);c._remove(b,!0);b._startTime=0;b._rawPrevTime=b._time=b._totalTime=c._time;for(var d=c._first,t;d;)t=d._next,(!e||
!(d instanceof f&&d.target===d.vars.onComplete))&&b.insert(d,d._startTime-d._delay),d=t;c.insert(b,0);return b};c.insert=function(a,e){if(!(a instanceof h)){if(a instanceof Array)return this.insertMultiple(a,e);if("string"===typeof a)return this.addLabel(a,this._parseTimeOrLabel(e||0,0,!0));if("function"===typeof a)a=f.delayedCall(0,a);else throw"ERROR: Cannot insert() "+a+" into the TimelineLite/Max because it is neither a tween, timeline, function, nor a String.";}p.prototype.insert.call(this,a,
this._parseTimeOrLabel(e||0,0,!0));if(this._gc&&!this._paused&&this._time===this._duration&&this._time<this.duration())for(var b=this;b._gc&&b._timeline;)b._timeline.smoothChildTiming?b.totalTime(b._totalTime,!0):b._enabled(!0,!1),b=b._timeline;return this};c.remove=function(a){if(a instanceof h)return this._remove(a,!1);if(a instanceof Array){for(var e=a.length;-1<--e;)this.remove(a[e]);return this}return"string"===typeof a?this.removeLabel(a):this.kill(null,a)};c.append=function(a,e){return this.insert(a,
this._parseTimeOrLabel(null,e,!0))};c.insertMultiple=function(a,e,b,c){for(var b=b||"normal",c=c||0,d,f=this._parseTimeOrLabel(e||0,0,!0),n=a.length,e=0;e<n;e++){if((d=a[e])instanceof Array)d=new g({tweens:d});this.insert(d,f);"string"===typeof d||"function"===typeof d||("sequence"===b?f=d._startTime+d.totalDuration()/d._timeScale:"start"===b&&(d._startTime-=d.delay()));f+=c}return this._uncache(!0)};c.appendMultiple=function(a,e,b,d){return this.insertMultiple(a,this._parseTimeOrLabel(null,e,!0),
b,d)};c.addLabel=function(a,e){this._labels[a]=e;return this};c.removeLabel=function(a){delete this._labels[a];return this};c.getLabelTime=function(a){return null!=this._labels[a]?this._labels[a]:-1};c._parseTimeOrLabel=function(a,e,b){if("string"===typeof e)return this._parseTimeOrLabel(e,b&&"number"===typeof a&&null==this._labels[e]?a-this.duration():0,b);e=e||0;return null==a?this.duration()+e:"string"===typeof a&&isNaN(a)?null==this._labels[a]?b?this._labels[a]=this.duration()+e:e:this._labels[a]+
e:Number(a)+e};c.seek=function(a,e){return this.totalTime(this._parseTimeOrLabel(a),!1!=e)};c.stop=function(){return this.paused(!0)};c.gotoAndPlay=function(a,e){return p.prototype.play.call(this,a,e)};c.gotoAndStop=function(a,e){return this.pause(a,e)};c.render=function(a,e,b){this._gc&&this._enabled(!0,!1);this._active=!this._paused;var d=!this._dirty?this._totalDuration:this.totalDuration(),c=this._time,f=this._startTime,g=this._timeScale,m=this._paused,k,h,l;if(a>=d){this._totalTime=this._time=
d;if(!this._reversed&&!this._hasPausedChild()&&(k=!0,l="onComplete",0===this._duration&&(0===a||0>this._rawPrevTime)))this._rawPrevTime!==a&&(b=!0);this._rawPrevTime=a;a=d+1E-6}else if(0>=a){this._totalTime=this._time=0;if(0!==c||0===this._duration&&0<this._rawPrevTime)l="onReverseComplete",k=this._reversed;0>a?(this._active=!1,0===this._duration&&0<=this._rawPrevTime&&(b=!0)):this._initted||(b=!0);this._rawPrevTime=a;a=-1E-6}else this._totalTime=this._time=this._rawPrevTime=a;if(this._time!==c||
b){this._initted||(this._initted=!0);0===c&&this.vars.onStart&&0!==this._time&&(e||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||s));if(this._time>c)for(b=this._first;b;){h=b._next;if(this._paused&&!m)break;else if(b._active||b._startTime<=this._time&&!b._paused&&!b._gc)b._reversed?b.render((!b._dirty?b._totalDuration:b.totalDuration())-(a-b._startTime)*b._timeScale,e,!1):b.render((a-b._startTime)*b._timeScale,e,!1);b=h}else for(b=this._last;b;){h=b._prev;if(this._paused&&
!m)break;else if(b._active||b._startTime<=c&&!b._paused&&!b._gc)b._reversed?b.render((!b._dirty?b._totalDuration:b.totalDuration())-(a-b._startTime)*b._timeScale,e,!1):b.render((a-b._startTime)*b._timeScale,e,!1);b=h}this._onUpdate&&(e||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||s));if(l&&!this._gc&&(f===this._startTime||g!=this._timeScale))if(0===this._time||d>=this.totalDuration())k&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),e||this.vars[l]&&
this.vars[l].apply(this.vars[l+"Scope"]||this,this.vars[l+"Params"]||s)}};c._hasPausedChild=function(){for(var a=this._first;a;){if(a._paused||a instanceof g&&a._hasPausedChild())return!0;a=a._next}return!1};c.getChildren=function(a,d,b,c){for(var c=c||-9999999999,i=[],g=this._first,h=0;g;)g._startTime<c||(g instanceof f?!1!=d&&(i[h++]=g):(!1!=b&&(i[h++]=g),!1!=a&&(i=i.concat(g.getChildren(!0,d,b)),h=i.length))),g=g._next;return i};c.getTweensOf=function(a,d){for(var b=f.getTweensOf(a),c=b.length,
g=[],h=0;-1<--c;)if(b[c].timeline===this||d&&this._contains(b[c]))g[h++]=b[c];return g};c._contains=function(a){for(a=a.timeline;a;){if(a===this)return!0;a=a.timeline}return!1};c.shiftChildren=function(a,d,b){for(var b=b||0,c=this._first;c;)c._startTime>=b&&(c._startTime+=a),c=c._next;if(d)for(var f in this._labels)this._labels[f]>=b&&(this._labels[f]+=a);return this._uncache(!0)};c._kill=function(a,c){if(null==a&&null==c)return this._enabled(!1,!1);for(var b=null==c?this.getChildren(!0,!0,!1):this.getTweensOf(c),
d=b.length,f=!1;-1<--d;)b[d]._kill(a,c)&&(f=!0);return f};c.clear=function(a){var c=this.getChildren(!1,!0,!0),b=c.length;for(this._time=this._totalTime=0;-1<--b;)c[b]._enabled(!1,!1);!1!=a&&(this._labels={});return this._uncache(!0)};c.invalidate=function(){for(var a=this._first;a;)a.invalidate(),a=a._next;return this};c._enabled=function(a,c){if(a===this._gc)for(var b=this._first;b;)b._enabled(a,!0),b=b._next;return p.prototype._enabled.call(this,a,c)};c.progress=function(a){return!arguments.length?
this._time/this.duration():this.totalTime(this.duration()*a,!1)};c.duration=function(a){if(!arguments.length)return this._dirty&&this.totalDuration(),this._duration;0!==this.duration()&&0!==a&&this.timeScale(this._duration/a);return this};c.totalDuration=function(a){if(!arguments.length){if(this._dirty){for(var c=0,b=this._first,d=-999999999999,f;b;)f=b._next,b._startTime<d&&this._sortChildren?this.insert(b,b._startTime-b._delay):d=b._startTime,0>b._startTime&&(c-=b._startTime,this.shiftChildren(-b._startTime,
!1,-9999999999)),b=b._startTime+(!b._dirty?b._totalDuration:b.totalDuration())/b._timeScale,b>c&&(c=b),b=f;this._duration=this._totalDuration=c;this._dirty=!1}return this._totalDuration}0!==this.totalDuration()&&0!==a&&this.timeScale(this._totalDuration/a);return this};c.usesFrames=function(){for(var a=this._timeline;a._timeline;)a=a._timeline;return a===h._rootFramesTimeline};c.rawTime=function(){return this._paused||0!==this._totalTime&&this._totalTime!==this._totalDuration?this._totalTime:(this._timeline.rawTime()-
this._startTime)*this._timeScale};return g},!0)});window._gsDefine&&_gsQueue.pop()();