Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates to AMD Rekapi.

  • Loading branch information...
commit d29f6a08447d2985ecd2c54a7d2d18ee3b2e9ca1 1 parent 0604890
@jeremyckahn authored
Showing with 487 additions and 158 deletions.
  1. +1 −1  bin/libs.js
  2. +34 −30 lib/rekapi.bundle.min.js
  3. +419 −98 lib/rekapi.js
  4. +33 −29 lib/rekapi.min.js
View
2  bin/libs.js
1 addition, 1 deletion not shown
View
64 lib/rekapi.bundle.min.js
@@ -1,5 +1,5 @@
/**
- * Rekapi - Rewritten Kapi. v0.4.13
+ * Rekapi - Rewritten Kapi. v0.6.0
* By Jeremy Kahn - jeremyckahn@gmail.com
* https://github.com/jeremyckahn/rekapi
*
@@ -46,7 +46,7 @@ arguments);return u(this._wrapped,this._chain)}});j(["concat","join","slice"],fu
*/
(function(){var a;(function(b){function f(a,b){var c;for(c in a)a.hasOwnProperty(c)&&b(a,c)}function g(a,b){return f(b,function(b,c){a[c]=b[c]}),a}function h(a,b){return f(b,function(b,c){typeof a[c]=="undefined"&&(a[c]=b[c])}),a}function i(a,b,c){var d,f;f=(a-b.timestamp)/b.duration;for(d in c.current)c.current.hasOwnProperty(d)&&b.to.hasOwnProperty(d)&&(c.current[d]=j(b.originalState[d],b.to[d],e[b.easing[d]],f));return c.current}function j(a,b,c,d){return a+(b-a)*c(d)}function k(a,b){return setTimeout(a,1e3/b)}function l(a,b,c,d){var e;for(e=0;e<b[a].length;e++)b[a][e].apply(c,d)}function m(b,c,d){f(a.prototype.filter,function(a,e){a[e][b]&&a[e][b].apply(c,d)})}function n(a,b){var d=a.timestamp+a.duration,e=Math.min(c(),d),f=e>=d;b.isTweening&&(f||(b.loopId=k(function(){n(a,b)},a.owner.fps)),m("beforeTween",a.owner,[b.current,a.originalState,a.to]),i(e,a,b),m("afterTween",a.owner,[b.current,a.originalState,a.to]),a.hook.step&&l("step",a.hook,a.owner,[b.current]),a.step&&a.step.call(b.current,b.current)),(f||!b.isTweening)&&a.owner.stop(!0)}function o(a,b){var c;return c={},typeof b=="string"?f(a,function(a,d){c[d]=b}):f(a,function(a,e){c[e]||(c[e]=b[e]||d)}),c}var c,d="linear",e;typeof SHIFTY_DEBUG_NOW=="function"?c=SHIFTY_DEBUG_NOW:c=function(){return+(new Date)},typeof SHIFTY_DEBUG_NOW=="function"&&(b.timeoutHandler=n),a=function(a){return a=a||{},this._hook={},this._tweenParams={owner:this,hook:this._hook,data:{}},this._state={},this._state.current=a.initialState||{},this.fps=a.fps||30,this.easing=a.easing||d,this.duration=a.duration||500,this},a.prototype.tween=function(a,b,d,e,f){var i,j,k;if(this._state.isTweening)return;return i=this,j=this._tweenParams,k=this._state,this._state.loopId=0,this._state.pausedAtTime=null,b?(j.to=b||{},j.duration=d||this.duration,j.callback=e,j.easing=f||this.easing,k.current=a||{}):(j.step=a.step,j.callback=a.callback,j.to=a.to||a.target||{},j.duration=a.duration||this.duration,j.easing=a.easing||this.easing,k.current=a.from||{}),j.timestamp=c(),h(k.current,j.to),h(j.to,k.current),j.easing=o(k.current,j.easing),m("tweenCreated",j.owner,[k.current,j.originalState,j.to]),j.originalState=g({},k.current),k.isTweening=!0,this.resume(),a.start&&a.start(),this},a.prototype.to=function(b,c,d,e){return arguments.length===1?"to"in b?(b.from=this.get(),this.tween(b)):this.tween(this.get(),b):this.tween(this.get(),b,c,d,e),this},a.prototype.get=function(){return this._state.current},a.prototype.set=function(a){return this._state.current=a||{},this},a.prototype.stop=function(a){return clearTimeout(this._state.loopId),this._state.isTweening=!1,a&&(g(this._state.current,this._tweenParams.to),m("afterTweenEnd",this,[this._state.current,this._tweenParams.originalState,this._tweenParams.to]),this._tweenParams.callback&&this._tweenParams.callback.call(this._state.current,this._state.current)),this},a.prototype.pause=function(){return clearTimeout(this._state.loopId),this._state.pausedAtTime=c(),this._state.isPaused=!0,this},a.prototype.resume=function(){var a;return a=this,this._state.isPaused&&(this._tweenParams.timestamp+=c()-this._state.pausedAtTime),n(a._tweenParams,a._state),this},a.prototype.hookAdd=function(a,b){this._hook.hasOwnProperty(a)||(this._hook[a]=[]),this._hook[a].push(b)},a.prototype.hookRemove=function(a,b){var c;if(!this._hook.hasOwnProperty(a))return;if(!b){this._hook[a]=[];return}for(c=this._hook[a].length;c>=0;c++)this._hook[a][c]===b&&this._hook[a].splice(c,1)},a.prototype.filter={},a.util={now:c,each:f,tweenProps:i,tweenProp:j,applyFilter:m,simpleCopy:g,weakCopy:h,composeEasingObject:o},e=a.prototype.formula={linear:function(a){return a}},typeof exports=="object"?module.exports=a:typeof define=="function"&&define.amd?define(function(){return a}):typeof b.Tweenable=="undefined"&&(b.Tweenable=a)})(this),function(){a.util.simpleCopy(a.prototype.formula,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return-(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){return(a/=.5)<1?.5*Math.pow(a,2):-0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return-(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return Math.pow(a-1,5)+1},easeInOutQuint:function(a){return(a/=.5)<1?.5*Math.pow(a,5):.5*(Math.pow(a-2,5)+2)},easeInSine:function(a){return-Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a)-1)},easeInExpo:function(a){return a==0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a==1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){return a==0?0:a==1?1:(a/=.5)<1?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return-(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){return(a/=.5)<1?-0.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},elastic:function(a){return-1*Math.pow(4,-8*a)*Math.sin((a*6-1)*2*Math.PI/2)+1},swingFromTo:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},swingFrom:function(a){var b=1.70158;return a*a*((b+1)*a-b)},swingTo:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},bounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},bouncePast:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?2-(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?2-(7.5625*(a-=2.25/2.75)*a+.9375):2-(7.5625*(a-=2.625/2.75)*a+.984375)},easeFromTo:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,.25)}})}(),function(){function c(a){a.shift(),a.length?a[0]():a.running=!1}function d(a,b){return function(){a(),c(b)}}function e(a,b,c,d,e,f){return function(){c?a.tween(b,c,d,e,f):(b.callback=e,b.from?a.tween(b):a.to(b))}}var b=function(){};a.prototype.queue=function(a,c,f,g,h){var i;return this._tweenQueue||(this._tweenQueue=[]),g=g||a.callback||b,i=d(g,this._tweenQueue),this._tweenQueue.push(e(this,a,c,f,i,h)),this},a.prototype.queueStart=function(){return!this._tweenQueue.running&&this._tweenQueue.length>0&&(this._tweenQueue[0](),this._tweenQueue.running=!0),this},a.prototype.queueShift=function(){return this._tweenQueue.shift(),this},a.prototype.queuePop=function(){return this._tweenQueue.pop(),this},a.prototype.queueEmpty=function(){return this._tweenQueue.length=0,this},a.prototype.queueLength=function(){return this._tweenQueue.length}}(),function(){function f(a){return parseInt(a,16)}function g(a){return a=a.replace(/#/g,""),a.length===3&&(a=a.split(""),a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),[f(a.substr(0,2)),f(a.substr(2,2)),f(a.substr(4,2))]}function h(a){var b,c;return b=g(a),c="rgb("+b[0]+","+b[1]+","+b[2]+")",c}function i(a){return typeof a=="string"&&(b.test(a)||c.test(a)||d.test(a))}function j(a){return typeof a=="string"&&(b.test(a)||c.test(a))}function k(b){a.util.each(b,function(a,b){j(a[b])&&(a[b]=h(a[b]))})}function l(b){var c;return c=[],a.util.each(b,function(a,b){i(a[b])&&c.push(b)}),c}function m(a){return a.match(/(\d+)/g)}function n(a,b){var c,d,e;d=b.length;for(c=0;c<d;c++)e=m(a[b[c]]),a["__r__"+b[c]]=+e[0],a["__g__"+b[c]]=+e[1],a["__b__"+b[c]]=+e[2],delete a[b[c]]}function o(a,b){var c,d;d=b.length;for(c=0;c<d;c++)a[b[c]]="rgb("+parseInt(a["__r__"+b[c]],10)+","+parseInt(a["__g__"+b[c]],10)+","+parseInt(a["__b__"+b[c]],10)+")",delete a["__r__"+b[c]],delete a["__g__"+b[c]],delete a["__b__"+b[c]]}function p(a,b){var c,d;d=b.length;for(c=0;c<d;c++)a["__r__"+b[c]]=a[b[c]],a["__g__"+b[c]]=a[b[c]],a["__b__"+b[c]]=a[b[c]]}function q(a,b){var c,d;d=b.length;for(c=0;c<d;c++)delete a["__r__"+b[c]],delete a["__g__"+b[c]],delete a["__b__"+b[c]]}var b=/^#([0-9]|[a-f]){3}$/i,c=/^#([0-9]|[a-f]){6}$/i,d=/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)\s*$/i,e;if(!a)return;a.prototype.filter.color={tweenCreated:function(a,b,c){k(a),k(b),k(c)},beforeTween:function(a,b,c){e=l(b),n(a,e),n(b,e),n(c,e),p(this._tweenParams.easing,e)},afterTween:function(a,b,c){o(a,e),o(b,e),o(c,e),q(this._tweenParams.easing,e)}}}(),function(){function e(a){return typeof a=="string"&&b.test(a)}function f(c){var d;return d={},a.util.each(c,function(a,c){e(a[c])&&(d[c]={suffix:a[c].match(b)[0]})}),d}function g(b,d){a.util.each(d,function(a,d){b[d]=+b[d].replace(c,"")})}function h(b,c){a.util.each(c,function(a,c){b[c]=b[c]+a[c].suffix})}var b=/(px|em|%|pc|pt|mm|cm|in|ex)/i,c=/([a-z]|%)/gi,d;a.prototype.filter.token={beforeTween:function(a,b,c){d=f(b),g(a,d),g(b,d),g(c,d)},afterTween:function(a,b,c){h(a,d),h(b,d),h(c,d)}}}(),function(){function b(b,c,d,e,f){var g;return g=a.util.composeEasingObject(b,f),a.util.tweenProps(e,{originalState:b,to:d,timestamp:0,duration:1,easing:g},{current:c})}if(!a)return;a.util.interpolate=function(c,d,e,f){var g,h,i;return c&&c.from&&(d=c.to,e=c.position,f=c.easing,c=c.from),i=new a,i._tweenParams.easing=f||"linear",g=a.util.simpleCopy({},c),a.util.applyFilter("tweenCreated",i,[g,c,d]),a.util.applyFilter("beforeTween",i,[g,c,d]),h=b(c,g,d,e,i._tweenParams.easing),a.util.applyFilter("afterTween",i,[h,c,d]),h},a.prototype.interpolate=function(b,c,d){var e;return e=a.util.interpolate(this.get(),b,c,d),this.set(e),e}}(),function(){var b=!1;a.util.enableRounding=function(){b=!0},a.util.disableRounding=function(){b=!1},a.util.isRoundingEnabled=function(){return b},a.prototype.filter.round={afterTween:function(c,d,e){b&&a.util.each(c,function(a,b){a[b].replace||(a[b]=Math.round(a[b]))})}}}()})();
/**
- * Rekapi - Rewritten Kapi. v0.4.13
+ * Rekapi - Rewritten Kapi. v0.6.0
* By Jeremy Kahn - jeremyckahn@gmail.com
* https://github.com/jeremyckahn/rekapi
*
@@ -54,31 +54,35 @@ arguments);return u(this._wrapped,this._chain)}});j(["concat","join","slice"],fu
* Dependencies: Underscore.js (https://github.com/documentcloud/underscore), Shifty.js (https://github.com/jeremyckahn/shifty)
* MIT Lincense. This code free to use, modify, distribute and enjoy.
*/
-(function(f){function j(b){return b.sort(function(b,a){return b-a})}function e(b,a){return Math.floor(a/b._animationLength)}function i(b){return g()-b._loopTimestamp}function k(b,a){return a>=b._timesToIterate&&-1!==b._timesToIterate}function l(b,o){k(b,o)&&(b.stop(),a(b,"onAnimationComplete"))}function n(b,a,c){return k(b,c)?b._animationLength:a%b._animationLength}function h(b){var a=i(b),c;c=e(b,a);a=n(b,a,c);l(b,c);b.render(a)}function m(b){b._loopId=setTimeout(function(){m(b);h(b)},1E3/b.config.fps)}
-function a(b,a){_.each(b._events[a],function(a){a(b)})}var d={fps:30,height:150,width:300,doRoundNumbers:!1,clearOnUpdate:!0},g=Tweenable.util.now,c=f.Kapi||function(b,a){this.canvas=b;this._contextType=null;this.canvas_setContext(b);this.config={};this._actors={};this._drawOrder=[];this._playState="stopped";this._drawOrderSorter=null;this._events={onFrameRender:[],onAnimationComplete:[],onPlayStateChange:[],onPlay:[],onPause:[],onStop:[]};this._timesToIterate=-1;this._animationLength=0;this._pausedAtTime=
-this._loopTimestamp=this._loopId=null;this._lastRenderedMillisecond=0;_.extend(this.config,a);_.defaults(this.config,d);_.each(["height","width"],function(b){this.config[b]&&(this["canvas_"+b](this.config[b]),delete this.config[b])},this);return this};c.prototype.addActor=function(b){if(!_.contains(this._actors,b))b.kapi=this,b.fps=this.framerate(),this._actors[b.id]=b,this._drawOrder.push(b.id),b.setup();return this};c.prototype.getActor=function(b){return this._actors[b]};c.prototype.getActorIds=
-function(){return _.pluck(this._actors,"id")};c.prototype.getAllActors=function(){return _.clone(this._actors)};c.prototype.removeActor=function(b){delete this._actors[b.id];delete b.kapi;this._drawOrder=_.without(this._drawOrder,b.id);b.teardown();this.updateInternalState();return this};c.prototype.play=function(b){clearTimeout(this._loopId);this._loopTimestamp="paused"===this._playState?this._loopTimestamp+(g()-this._pausedAtTime):g();this._timesToIterate=b||-1;this._playState="playing";m(this);
-_.each(this._actors,function(b){b._state.isPaused&&b.resume()});a(this,"onPlayStateChange");a(this,"onPlay");return this};c.prototype.playFrom=function(b,a){this.play(a);this._loopTimestamp=g()-b;return this};c.prototype.playFromCurrent=function(b){return this.playFrom(this._lastRenderedMillisecond,b)};c.prototype.pause=function(){if("paused"===this._playState)return this;this._playState="paused";clearTimeout(this._loopId);this._pausedAtTime=g();_.each(this._actors,function(b){b._state.isTweening&&
-b.pause()});a(this,"onPlayStateChange");a(this,"onPause");return this};c.prototype.stop=function(b){this._playState="stopped";clearTimeout(this._loopId);!0===b&&this.canvas_clear();_.each(this._actors,function(a){a.stop();!0===b&&a.hide()});a(this,"onPlayStateChange");a(this,"onStop");return this};c.prototype.isPlaying=function(){return"playing"===this._playState};c.prototype.animationLength=function(){return this._animationLength};c.prototype.lastPositionRendered=function(){return this._lastRenderedMillisecond/
-this._animationLength};c.prototype.actorCount=function(){return this._drawOrder.length};c.prototype.framerate=function(b){if(b)this.config.fps=b;return this.config.fps};c.prototype.render=function(b){this.calculateActorPositions(b);this.draw();this._lastRenderedMillisecond=b;a(this,"onFrameRender");return this};c.prototype.redraw=function(){this.render(this._lastRenderedMillisecond);return this};c.prototype.calculateActorPositions=function(b){var a,c,d;d=Tweenable.util.isRoundingEnabled();this.config.doRoundNumbers?
-Tweenable.util.enableRounding():Tweenable.util.disableRounding();c=this._drawOrder.length;for(a=0;a<c;a++)this._actors[this._drawOrder[a]].calculatePosition(b);!0===d?Tweenable.util.enableRounding():Tweenable.util.disableRounding();return this};c.prototype.draw=function(){var b,a,c,d,g;this.config.clearOnUpdate&&this.canvas_clear();a=this._drawOrder.length;d=this.canvas_getContext();this._drawOrderSorter?(b=_.sortBy(this._actors,this._drawOrderSorter),g=_.pluck(b,"id")):g=this._drawOrder;for(b=0;b<
-a;b++)c=this._actors[g[b]],c.isShowing()&&c.draw(d,c.get());return this};c.prototype.updateInternalState=function(){var a=[];_.each(this._actors,function(c){a.push(c.getEnd())});this._animationLength=Math.max.apply(Math,a);return this};c.prototype.moveActorToLayer=function(a,c){if(c<this._drawOrder.length)return this._drawOrder=_.without(this._drawOrder,a.id),this._drawOrder.splice(c,0,a.id),a};c.prototype.bind=function(a,c){if(this._events[a])return this._events[a].push(c),this};c.prototype.unbind=
-function(a,c){if(this._events[a])return this._events[a]=c?_.without(this._events[a],c):[],this};c.prototype.setOrderFunction=function(a){this._drawOrderSorter=a;return this};c.prototype.unsetOrderFunction=function(){this._drawOrderSorter=null;return this};c.prototype.exportTimeline=function(){var a={duration:this._animationLength,actorOrder:this._drawOrder.slice(0),actors:{}};_.each(this._drawOrder,function(c){a.actors[c]=this._actors[c].exportTimeline()},this);return a};c.util={};_.extend(c.util,
-{noop:function(){},sortNumerically:j,calculateLoopPosition:n,calculateTimeSinceStart:i});if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)c._private={sortNumerically:j,calculateLoopPosition:n,renderCurrentMillisecond:h,tick:m,determineCurrentLoopIteration:e,calculateTimeSinceStart:i,isAnimationComplete:k,updatePlayState:l};f.Rekapi=f.Kapi=c})(this);
-(function(f){function j(a,d){var g,c,b;b=a._timelinePropertyCacheIndex;c=b.length;for(g=1;g<c;g++)if(b[g]>=d)return g-1;return-1}function e(a){_.each(a._propertyTracks,function(d,g){a._propertyTracks[g]=_.sortBy(a._propertyTracks[g],function(a){return a.millisecond})})}function i(a){_.each(a._timelinePropertyCaches,function(d,g){var c={};_.each(a._propertyTracks,function(a,d){var e=null;_.find(a,function(a){a.millisecond>g&&(c[d]=e);e=a;return!!c[d]})});_.defaults(d,c)})}function k(a){_.each(a._propertyTracks,
-function(a){_.each(a,function(g,c){g.linkToNext(a[c+1])})})}function l(a,d,g){return _.find(a._propertyTracks[d],function(a){return a.millisecond===g})}function n(a,d,g,c){var b=_.keys(a._propertyTracks),e=_.keys(d),b=_.difference(b,e),h={};_.each(b,function(b){var d;d=a._propertyTracks[b].slice(0).reverse();_.each(d,function(a){a.millisecond<c&&!h[b]&&(h[b]={value:a.value,easing:a.easing})})});_.each(h,function(a,b){d[b]=a.value;g[b]=a.easing})}var h,m;h=f.Kapi;m=0;h.Actor=function(a){a=a||{};this.constructor.call(this);
-_.extend(this,{_data:{},_propertyTracks:{},_timelinePropertyCaches:{},_timelinePropertyCacheIndex:[],_keyframeProperties:{},_isShowing:!1,_isPersisting:!1,id:m++,setup:a.setup||h.util.noop,draw:a.draw||h.util.noop,teardown:a.teardown||h.util.noop});return this};f=function(){};f.prototype=Tweenable.prototype;h.Actor.prototype=new f;h.Actor.prototype.keyframe=function(a,d,g){var c;g||(g="linear");"string"===typeof g&&(c=g,g={},_.each(d,function(a,d){g[d]=c}));_.each(d,function(a,c){g[c]=g[c]||"linear"});
-n(this,d,g,a);_.each(d,function(b,c){var d;d=new h.KeyframeProperty(this,a,c,b,g[c]);this._keyframeProperties[d.id]=d;this._propertyTracks[c]||(this._propertyTracks[c]=[]);this._propertyTracks[c].push(d);e(this)},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};h.Actor.prototype.getKeyframeProperty=function(a,d){if(this._propertyTracks[a]&&this._propertyTracks[a][d])return this._propertyTracks[a][d]};h.Actor.prototype.modifyKeyframeProperty=function(a,d,g){this._propertyTracks[a]&&
-this._propertyTracks[a][d]&&this._propertyTracks[a][d].modifyWith(g);e(this);this.invalidatePropertyCache();return this};h.Actor.prototype.getTrackNames=function(){return _.keys(this._propertyTracks)};h.Actor.prototype.getTrackLength=function(a){return!this._propertyTracks[a]?void 0:this._propertyTracks[a].length};h.Actor.prototype.copyProperties=function(a,d){var g,c;g={};c={};_.each(this._propertyTracks,function(a,e){var h;if(h=l(this,e,d))g[e]=h.value,c[e]=h.easing},this);this.keyframe(a,g,c);
-return this};h.Actor.prototype.wait=function(a){var d=this.getEnd();if(!(a<=d))return this.copyProperties(a,d),this};h.Actor.prototype.getStart=function(){var a=[];_.each(this._propertyTracks,function(d){d.length&&a.push(d[0].millisecond)});0===a.length&&(a=[0]);return Math.min.apply(Math,a)};h.Actor.prototype.getEnd=function(){var a=0;_.each(this._propertyTracks,function(d){if(d.length)d=_.last(d).millisecond,d>a&&(a=d)},this);return a};h.Actor.prototype.modifyKeyframe=function(a,d,g){g=g||{};_.each(this._propertyTracks,
-function(c,b){var e=l(this,b,a);e&&e.modifyWith({value:d[b],easing:g[b]})},this);return this};h.Actor.prototype.removeKeyframe=function(a){_.each(this._propertyTracks,function(d){var g=-1;_.find(d,function(c){g++;return a===c.millisecond});(d=d.splice(g,1)[0])&&delete this._keyframeProperties[d.id]},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};h.Actor.prototype.removeAllKeyframeProperties=function(){_.each(this._propertyTracks,function(a){a.length=0},this);this._keyframeProperties=
-{};return this.removeKeyframe(0)};h.Actor.prototype.moveToLayer=function(a){return this.kapi.moveActorToLayer(this,a)};h.Actor.prototype.show=function(a){this._isShowing=!0;this._isPersisting=!!a;return this};h.Actor.prototype.hide=function(a){this._isShowing=!1;if(!0===a)this._isPersisting=!1;return this};h.Actor.prototype.isShowing=function(){return this._isShowing||this._isPersisting};h.Actor.prototype.calculatePosition=function(a){var d,g,c;d=this.getStart();g=this.getEnd();this.hide();d<=a&&
-a<=g&&(this.show(),d=j(this,a),d=this._timelinePropertyCaches[this._timelinePropertyCacheIndex[d]],c={},_.each(d,function(b,d){c[d]=b.getValueAt(a)}),this.set(c));return this};h.Actor.prototype.data=function(a){if(a)this._data=a;return this._data};h.Actor.prototype.exportTimeline=function(){var a={start:this.getStart(),end:this.getEnd(),trackNames:this.getTrackNames(),propertyTracks:{}};_.each(this._propertyTracks,function(d,g){var c=a.propertyTracks[g]=[];_.each(d,function(a){c.push(a.exportPropertyData())})});
-return a};h.Actor.prototype.invalidatePropertyCache=function(){this._timelinePropertyCaches={};_.each(this._keyframeProperties,function(a){this._timelinePropertyCaches[a.millisecond]||(this._timelinePropertyCaches[a.millisecond]={});this._timelinePropertyCaches[a.millisecond][a.name]=a},this);this._timelinePropertyCacheIndex=_.keys(this._timelinePropertyCaches);_.each(this._timelinePropertyCacheIndex,function(a,d){this._timelinePropertyCacheIndex[d]=+a},this);h.util.sortNumerically(this._timelinePropertyCacheIndex);
-i(this);k(this)};_.each(["tween","to"],function(a){h.Actor.prototype[a]=function(){this.show(!0);Tweenable.prototype[a].apply(this,arguments)}},this)})(this);
-(function(f){var j,e;j=f.Kapi;e=["transform","webkitTransform","MozTransform","oTransform","msTransform"];if(f.getComputedStyle)j.DOMActor=function(i){var k;k=new j.Actor({setup:function(){var e=this.kapi.canvas_getContext();"static"===f.getComputedStyle(e).getPropertyValue("position")&&(this.kapi.canvas_getContext().style.position="relative");"static"===f.getComputedStyle(i).getPropertyValue("position")&&(i.style.position="absolute")},draw:function(f,j){var h;h=!1;_.each(j,function(f,a){h=!0;"rotate"===
-a?_.each(e,function(a){i.style[a]="rotate("+f+"deg)"}):i.style[a]=f});i.style.display=h?"block":"none"}});k.show=function(e){j.Actor.prototype.show.call(this,e);i.style.display="block"};k.hide=function(e){j.Actor.prototype.hide.call(this,e);i.style.display="none"};return k}})(this);
-(function(f){function j(e,f,j,l){if("undefined"!==typeof l){e[j]=l;if(!e.style)e.style={};e.style[j]=l+"px"}return f===f.HTML_ELEMENT?e.style[j]:e[j]}f=f.Kapi;f.prototype.canvas_setContext=function(e){var f;this._canvas=e;f=e.nodeName;void 0===f?(this._context={},this._contextType="other"):"CANVAS"===f?(this._context=e.getContext("2d"),this._contextType="canvas"):(this._context=e,this._contextType="HTMLElement");return this.canvas_getContext()};f.prototype.canvas_getContext=function(){return this._context};
-f.prototype.canvas_height=function(e){return j(this.canvas,this._contextType,"height",e)};f.prototype.canvas_width=function(e){return j(this.canvas,this._contextType,"width",e)};f.prototype.canvas_style=function(e,f){"undefined"!==typeof f&&this.canvas.style&&(this.canvas.style[e]=f);return this.canvas.style[e]};f.prototype.canvas_clear=function(){"canvas"===this._contextType&&this.canvas_getContext().clearRect(0,0,this.canvas_width(),this.canvas_height());return this}})(this);
-(function(f){f=f.Kapi;f.KeyframeProperty=function(f,e,i,k,l){this.id=_.uniqueId("keyframeProperty_");this.ownerActor=f;this.millisecond=e;this.name=i;this.value=k;this.easing=l||"linear";this.nextProperty=null;return this};f.KeyframeProperty.prototype.modifyWith=function(f){var e={};_.each(["millisecond","easing","value"],function(i){e[i]="undefined"===typeof f[i]?this[i]:f[i]},this);_.extend(this,e)};f.KeyframeProperty.prototype.linkToNext=function(f){this.nextProperty=f||null};f.KeyframeProperty.prototype.getValueAt=
-function(f){var e,i,k;e={};i={};this.nextProperty?(e[this.name]=this.value,i[this.name]=this.nextProperty.value,k=this.nextProperty.millisecond-this.millisecond,f=(f-this.millisecond)/k,e=Tweenable.util.interpolate(e,i,f,this.nextProperty.easing)[this.name]):e=null;return e};f.KeyframeProperty.prototype.exportPropertyData=function(){return{id:this.id,millisecond:this.millisecond,name:this.name,value:this.value,easing:this.easing}}})(this);
+(function(r){var v=function(h,f){function c(b){return b.sort(function(b,a){return b-a})}function l(b,a){return Math.floor(a/b._animationLength)}function m(b){return e()-b._loopTimestamp}function n(b,a){return a>=b._timesToIterate&&-1!==b._timesToIterate}function k(b,a){n(b,a)&&(b.stop(),j(b,"onAnimationComplete"))}function o(b,a,d){return n(b,d)?b._animationLength:a%b._animationLength}function i(b){var a=m(b),d;d=l(b,a);a=o(b,a,d);b.render(a);k(b,d)}function p(b){b._loopId=setTimeout(function(){p(b);
+i(b)},1E3/b.config.fps)}function j(b,a){g.each(b._events[a],function(a){a(b)})}var g=f&&f.underscore?f.underscore:h._,q=f&&f.Tweenable?f.Tweenable:h.Tweenable,a={fps:30,height:150,width:300,doRoundNumbers:!1,clearOnUpdate:!0},e=q.util.now,d=h.Kapi||function(b,d){this.canvas=b;this._contextType=null;this.canvas_setContext(b);this.config={};this._actors={};this._drawOrder=[];this._playState="stopped";this._drawOrderSorter=null;this._events={onFrameRender:[],onAnimationComplete:[],onPlayStateChange:[],
+onPlay:[],onPause:[],onStop:[]};this._timesToIterate=-1;this._animationLength=0;this._pausedAtTime=this._loopTimestamp=this._loopId=null;this._lastRenderedMillisecond=0;g.extend(this.config,d);g.defaults(this.config,a);g.each(["height","width"],function(b){this.config[b]&&(this["canvas_"+b](this.config[b]),delete this.config[b])},this);return this};d.prototype.addActor=function(b){if(!g.contains(this._actors,b))b.kapi=this,b.fps=this.framerate(),this._actors[b.id]=b,this._drawOrder.push(b.id),b.setup();
+return this};d.prototype.getActor=function(b){return this._actors[b]};d.prototype.getActorIds=function(){return g.pluck(this._actors,"id")};d.prototype.getAllActors=function(){return g.clone(this._actors)};d.prototype.removeActor=function(b){delete this._actors[b.id];delete b.kapi;this._drawOrder=g.without(this._drawOrder,b.id);b.teardown();this.updateInternalState();return this};d.prototype.play=function(b){clearTimeout(this._loopId);this._loopTimestamp="paused"===this._playState?this._loopTimestamp+
+(e()-this._pausedAtTime):e();this._timesToIterate=b||-1;this._playState="playing";p(this);g.each(this._actors,function(b){b._state.isPaused&&b.resume()});j(this,"onPlayStateChange");j(this,"onPlay");return this};d.prototype.playFrom=function(b,a){this.play(a);this._loopTimestamp=e()-b;return this};d.prototype.playFromCurrent=function(b){return this.playFrom(this._lastRenderedMillisecond,b)};d.prototype.pause=function(){if("paused"===this._playState)return this;this._playState="paused";clearTimeout(this._loopId);
+this._pausedAtTime=e();g.each(this._actors,function(b){b._state.isTweening&&b.pause()});j(this,"onPlayStateChange");j(this,"onPause");return this};d.prototype.stop=function(b){this._playState="stopped";clearTimeout(this._loopId);!0===b&&this.canvas_clear();g.each(this._actors,function(a){a.stop();!0===b&&a.hide()});j(this,"onPlayStateChange");j(this,"onStop");return this};d.prototype.isPlaying=function(){return"playing"===this._playState};d.prototype.animationLength=function(){return this._animationLength};
+d.prototype.lastPositionRendered=function(){return this._lastRenderedMillisecond/this._animationLength};d.prototype.actorCount=function(){return this._drawOrder.length};d.prototype.framerate=function(b){if(b)this.config.fps=b;return this.config.fps};d.prototype.render=function(b){this.calculateActorPositions(b);this.draw();this._lastRenderedMillisecond=b;j(this,"onFrameRender");return this};d.prototype.redraw=function(){this.render(this._lastRenderedMillisecond);return this};d.prototype.calculateActorPositions=
+function(b){var a,d,e;e=q.util.isRoundingEnabled();this.config.doRoundNumbers?q.util.enableRounding():q.util.disableRounding();d=this._drawOrder.length;for(a=0;a<d;a++)this._actors[this._drawOrder[a]].calculatePosition(b);!0===e?q.util.enableRounding():q.util.disableRounding();return this};d.prototype.draw=function(){var b,a,d,e,c;this.config.clearOnUpdate&&this.canvas_clear();a=this._drawOrder.length;e=this.canvas_getContext();this._drawOrderSorter?(b=g.sortBy(this._actors,this._drawOrderSorter),
+c=g.pluck(b,"id")):c=this._drawOrder;for(b=0;b<a;b++)d=this._actors[c[b]],d.isShowing()&&d.draw(e,d.get());return this};d.prototype.updateInternalState=function(){var b=[];g.each(this._actors,function(a){b.push(a.getEnd())});this._animationLength=Math.max.apply(Math,b);return this};d.prototype.moveActorToLayer=function(b,a){if(a<this._drawOrder.length)return this._drawOrder=g.without(this._drawOrder,b.id),this._drawOrder.splice(a,0,b.id),b};d.prototype.bind=function(b,a){if(this._events[b])return this._events[b].push(a),
+this};d.prototype.unbind=function(b,a){if(this._events[b])return this._events[b]=a?g.without(this._events[b],a):[],this};d.prototype.setOrderFunction=function(a){this._drawOrderSorter=a;return this};d.prototype.unsetOrderFunction=function(){this._drawOrderSorter=null;return this};d.prototype.exportTimeline=function(){var a={duration:this._animationLength,actorOrder:this._drawOrder.slice(0),actors:{}};g.each(this._drawOrder,function(d){a.actors[d]=this._actors[d].exportTimeline()},this);return a};
+d.util={};g.extend(d.util,{noop:function(){},sortNumerically:c,calculateLoopPosition:o,calculateTimeSinceStart:m});if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)d._private={sortNumerically:c,calculateLoopPosition:o,renderCurrentMillisecond:i,tick:p,determineCurrentLoopIteration:l,calculateTimeSinceStart:m,isAnimationComplete:n,updatePlayState:k};h.Rekapi=h.Kapi=d},w=function(h,f){function c(a,e){var d,b,g;g=a._timelinePropertyCacheIndex;b=g.length;for(d=1;d<b;d++)if(g[d]>=e)return d-1;return-1}
+function l(a){g.each(a._propertyTracks,function(e,d){a._propertyTracks[d]=g.sortBy(a._propertyTracks[d],function(a){return a.millisecond})})}function m(a){g.each(a._timelinePropertyCaches,function(e,d){var b={};g.each(a._propertyTracks,function(a,e){var c=null;g.find(a,function(a){a.millisecond>d&&(b[e]=c);c=a;return!!b[e]})});g.defaults(e,b)})}function n(a){g.each(a._propertyTracks,function(a){g.each(a,function(d,b){d.linkToNext(a[b+1])})})}function k(a,e,d){return g.find(a._propertyTracks[e],function(a){return a.millisecond===
+d})}function o(a,e,d,b){var c=g.keys(a._propertyTracks),f=g.keys(e),c=g.difference(c,f),i={};g.each(c,function(d){var e;e=a._propertyTracks[d].slice(0).reverse();g.each(e,function(a){a.millisecond<b&&!i[d]&&(i[d]={value:a.value,easing:a.easing})})});g.each(i,function(a,b){e[b]=a.value;d[b]=a.easing})}var i,p,j,g=f&&f.underscore?f.underscore:h._,q=f&&f.Tweenable?f.Tweenable:h.Tweenable;i=h.Kapi;p=0;i.Actor=function(a){a=a||{};this.constructor.call(this);g.extend(this,{_data:{},_propertyTracks:{},_timelinePropertyCaches:{},
+_timelinePropertyCacheIndex:[],_keyframeProperties:{},_isShowing:!1,_isPersisting:!1,id:p++,setup:a.setup||i.util.noop,draw:a.draw||i.util.noop,teardown:a.teardown||i.util.noop});return this};j=function(){};j.prototype=q.prototype;i.Actor.prototype=new j;i.Actor.prototype.keyframe=function(a,e,d){var b;d||(d="linear");"string"===typeof d&&(b=d,d={},g.each(e,function(a,e){d[e]=b}));g.each(e,function(a,b){d[b]=d[b]||"linear"});o(this,e,d,a);g.each(e,function(b,e){var g;g=new i.KeyframeProperty(this,
+a,e,b,d[e]);this._keyframeProperties[g.id]=g;this._propertyTracks[e]||(this._propertyTracks[e]=[]);this._propertyTracks[e].push(g);l(this)},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};i.Actor.prototype.getKeyframeProperty=function(a,e){if(this._propertyTracks[a]&&this._propertyTracks[a][e])return this._propertyTracks[a][e]};i.Actor.prototype.modifyKeyframeProperty=function(a,e,d){this._propertyTracks[a]&&this._propertyTracks[a][e]&&this._propertyTracks[a][e].modifyWith(d);
+l(this);this.invalidatePropertyCache();return this};i.Actor.prototype.getTrackNames=function(){return g.keys(this._propertyTracks)};i.Actor.prototype.getTrackLength=function(a){return!this._propertyTracks[a]?void 0:this._propertyTracks[a].length};i.Actor.prototype.copyProperties=function(a,e){var d,b;d={};b={};g.each(this._propertyTracks,function(a,g){var c;if(c=k(this,g,e))d[g]=c.value,b[g]=c.easing},this);this.keyframe(a,d,b);return this};i.Actor.prototype.wait=function(a){var e=this.getEnd();if(a<=
+e)return this;this.copyProperties(a,e);return this};i.Actor.prototype.getStart=function(){var a=[];g.each(this._propertyTracks,function(e){e.length&&a.push(e[0].millisecond)});0===a.length&&(a=[0]);return Math.min.apply(Math,a)};i.Actor.prototype.getEnd=function(){var a=0;g.each(this._propertyTracks,function(e){if(e.length)e=g.last(e).millisecond,e>a&&(a=e)},this);return a};i.Actor.prototype.getLength=function(){return this.getEnd()-this.getStart()};i.Actor.prototype.modifyKeyframe=function(a,e,d){d=
+d||{};g.each(this._propertyTracks,function(b,g){var c=k(this,g,a);c&&c.modifyWith({value:e[g],easing:d[g]})},this);return this};i.Actor.prototype.removeKeyframe=function(a){g.each(this._propertyTracks,function(e){var d=-1;g.find(e,function(b){d++;return a===b.millisecond});(e=e.splice(d,1)[0])&&delete this._keyframeProperties[e.id]},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};i.Actor.prototype.removeAllKeyframeProperties=function(){g.each(this._propertyTracks,
+function(a){a.length=0},this);this._keyframeProperties={};return this.removeKeyframe(0)};i.Actor.prototype.moveToLayer=function(a){return this.kapi.moveActorToLayer(this,a)};i.Actor.prototype.show=function(a){this._isShowing=!0;this._isPersisting=!!a;return this};i.Actor.prototype.hide=function(a){this._isShowing=!1;if(!0===a)this._isPersisting=!1;return this};i.Actor.prototype.isShowing=function(){return this._isShowing||this._isPersisting};i.Actor.prototype.calculatePosition=function(a){var e,d,
+b;e=this.getStart();d=this.getEnd();this.hide();e<=a&&a<=d&&(this.show(),e=c(this,a),e=this._timelinePropertyCaches[this._timelinePropertyCacheIndex[e]],b={},g.each(e,function(d,e){b[e]=d.getValueAt(a)}),this.set(b));return this};i.Actor.prototype.data=function(a){if(a)this._data=a;return this._data};i.Actor.prototype.exportTimeline=function(){var a={start:this.getStart(),end:this.getEnd(),trackNames:this.getTrackNames(),propertyTracks:{}};g.each(this._propertyTracks,function(e,d){var b=a.propertyTracks[d]=
+[];g.each(e,function(a){b.push(a.exportPropertyData())})});return a};i.Actor.prototype.invalidatePropertyCache=function(){this._timelinePropertyCaches={};g.each(this._keyframeProperties,function(a){this._timelinePropertyCaches[a.millisecond]||(this._timelinePropertyCaches[a.millisecond]={});this._timelinePropertyCaches[a.millisecond][a.name]=a},this);this._timelinePropertyCacheIndex=g.keys(this._timelinePropertyCaches);g.each(this._timelinePropertyCacheIndex,function(a,e){this._timelinePropertyCacheIndex[e]=
++a},this);i.util.sortNumerically(this._timelinePropertyCacheIndex);m(this);n(this)};g.each(["tween","to"],function(a){i.Actor.prototype[a]=function(){this.show(!0);q.prototype[a].apply(this,arguments)}},this)},x=function(h){function f(c,f,h,n){if("undefined"!==typeof n){c[h]=n;if(!c.style)c.style={};c.style[h]=n+"px"}return f===f.HTML_ELEMENT?c.style[h]:c[h]}h=h.Kapi;h.prototype.canvas_setContext=function(c){var f;this._canvas=c;f=c.nodeName;void 0===f?(this._context={},this._contextType="other"):
+"CANVAS"===f?(this._context=c.getContext("2d"),this._contextType="canvas"):(this._context=c,this._contextType="HTMLElement");return this.canvas_getContext()};h.prototype.canvas_getContext=function(){return this._context};h.prototype.canvas_height=function(c){return f(this.canvas,this._contextType,"height",c)};h.prototype.canvas_width=function(c){return f(this.canvas,this._contextType,"width",c)};h.prototype.canvas_style=function(c,f){"undefined"!==typeof f&&this.canvas.style&&(this.canvas.style[c]=
+f);return this.canvas.style[c]};h.prototype.canvas_clear=function(){"canvas"===this._contextType&&this.canvas_getContext().clearRect(0,0,this.canvas_width(),this.canvas_height());return this}},y=function(h,f){var c,l=f&&f.underscore?f.underscore:h._,m=f&&f.Tweenable?f.Tweenable:h.Tweenable;c=h.Kapi;c.KeyframeProperty=function(c,f,h,i,p){this.id=l.uniqueId("keyframeProperty_");this.ownerActor=c;this.millisecond=f;this.name=h;this.value=i;this.easing=p||"linear";this.nextProperty=null;return this};
+c.KeyframeProperty.prototype.modifyWith=function(c){var f={};l.each(["millisecond","easing","value"],function(h){f[h]="undefined"===typeof c[h]?this[h]:c[h]},this);l.extend(this,f)};c.KeyframeProperty.prototype.linkToNext=function(c){this.nextProperty=c||null};c.KeyframeProperty.prototype.getValueAt=function(c){var f,h,i;f={};h={};this.nextProperty?(f[this.name]=this.value,h[this.name]=this.nextProperty.value,i=this.nextProperty.millisecond-this.millisecond,c=(c-this.millisecond)/i,f=m.util.interpolate(f,
+h,c,this.nextProperty.easing)[this.name]):f=null;return f};c.KeyframeProperty.prototype.exportPropertyData=function(){return{id:this.id,millisecond:this.millisecond,name:this.name,value:this.value,easing:this.easing}}},s=function(h,f){var c=h.Kapi,l=f&&f.underscore?f.underscore:h._,m=["transform","webkitTransform","MozTransform","oTransform","msTransform"];if(h.getComputedStyle)c.DOMActor=function(f){var k;k=new c.Actor({setup:function(){var c=this.kapi.canvas_getContext();"static"===h.getComputedStyle(c).getPropertyValue("position")&&
+(this.kapi.canvas_getContext().style.position="relative");"static"===h.getComputedStyle(f).getPropertyValue("position")&&(f.style.position="absolute");this.hide()},draw:function(c,h){var k;k=!1;l.each(h,function(c,g){k=!0;"rotate"===g?l.each(m,function(g){f.style[g]="rotate("+c+"deg)"}):f.style[g]=c});k?this.show():this.hide()}});f.classList.add(k.getCSSName());k.show=function(h){c.Actor.prototype.show.call(this,h);f.style.display="block"};k.hide=function(h){c.Actor.prototype.hide.call(this,h);f.style.display=
+"none"};return k},h.Kapi.Actor.prototype.getCSSName=function(){return"actor-"+this.id}},t=function(h,f,c){function l(g){var c=["{"],a;o.each(g.get(),function(e,d){var b;/rgb/.test(e)?b=e:(b=e.match(/\D*$/),b=parseFloat(e).toFixed(2)+b);a=b;c.push(d+":"+a+";")});c.push("}");return c.join("")}function m(g,c,a){var a=a||["w3"],e=[];o.each(a,function(a){a=j(i,[k[a],c,g]);e.push(a)});return e.join("\n")}function n(g,c){var c=c||["w3"],a=[],e;o.each(c,function(d){var b=[],d=k[d],c=g.getStart(),f=g.getEnd()-
+c,f=j(" %sanimation-duration: %sms;",[d,f]);b.push(f);f=j(" %sanimation-name: %s;",[d,g.getCSSName()+"-keyframes"]);b.push(f);c=j(" %sanimation-delay: %sms;",[d,c]);b.push(c);d=j(" %sanimation-fill-mode: forwards;",[d]);b.push(d);e=b.join("\n");a.push(e)});return j(p,[g.getCSSName(),a.join("\n")])}var k=h.util.VENDOR_PREFIXES={microsoft:"-ms-",mozilla:"-moz-",opera:"-o-",w3:"",webkit:"-webkit-"},o=c&&c.underscore?c.underscore:f._,i="@%skeyframes %s-keyframes {\n%s\n}",p=".%s {\n position: absolute;\n%s\n}";
+f.Kapi.prototype.toCSS=function(c){var c=c||{},f=[],a=this.getActorIds();o.each(a,function(a){f.push(this.getActor(a).toCSS(c))},this);return f.join("\n")};f.Kapi.Actor.prototype.toCSS=function(c){var c=c||{},f=[],a=c.granularity||100,e=n(this,c.vendors);f.push(e);for(var e=this.getLength(),d=this.getStart(),b=[],h,i=e/a,j=e/100,a=d;a<=e+d;a+=i)this.calculatePosition(a),h=(a-d)/j,h=0===h?"from ":100===h?"to ":h.toFixed(2)+"% ",b.push(" "+h+l(this));e=b.join("\n");c=m(e,this.getCSSName(),c.vendors);
+f.push(c);return f.join("\n")};var j=h.util.printf=function(c,f){var a=c;o.each(f,function(c){a=a.replace("%s",c)});return a}},u=function(h,f){var c=f?{}:h;v(c,f);w(c,f);x(c,f);y(c,f);"function"===typeof s&&s(c,f);"function"===typeof t&&t(c.Kapi,c,f);return c.Kapi};if("function"===typeof define&&define.amd){var z="undefined"!==typeof _;define(["shifty","underscore"],function(h,f){var c={Tweenable:h,underscore:null!==f?f:_},l=u(r,c);if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)l.underscore_version=
+c.underscore.VERSION;z||delete r._;return l})}else u("undefined"!==typeof r?r:this)})(this);
View
517 lib/rekapi.js
@@ -1,5 +1,5 @@
/**
- * Rekapi - Rewritten Kapi. v0.4.13
+ * Rekapi - Rewritten Kapi. v0.6.0
* By Jeremy Kahn - jeremyckahn@gmail.com
* https://github.com/jeremyckahn/rekapi
*
@@ -7,7 +7,9 @@
* Dependencies: Underscore.js (https://github.com/documentcloud/underscore), Shifty.js (https://github.com/jeremyckahn/shifty)
* MIT Lincense. This code free to use, modify, distribute and enjoy.
*/
-;(function rekapiCore (global) {
+;(function(global) {
+
+var rekapiCore = function (global, deps) {
/**
* Sorts an array numerically, from smallest to largest.
@@ -104,8 +106,8 @@
currentIteration = determineCurrentLoopIteration(kapi, forMillisecond);
loopPosition = calculateLoopPosition(kapi, forMillisecond,
currentIteration);
- updatePlayState(kapi, currentIteration);
kapi.render(loopPosition);
+ updatePlayState(kapi, currentIteration);
}
@@ -152,6 +154,9 @@
function noop () {
// NOOP!
}
+
+ var _ = (deps && deps.underscore) ? deps.underscore : global._
+ ,Tweenable = (deps && deps.Tweenable) ? deps.Tweenable : global.Tweenable;
var defaultConfig = {
@@ -663,13 +668,15 @@
global.Rekapi = global.Kapi = gk;
-} (this));
-;(function rekapiActor (global) {
+};
+var rekapiActor = function (global, deps) {
var DEFAULT_EASING = 'linear'
,gk
,actorCount
- ,ActorMethods;
+ ,ActorMethods
+ ,_ = (deps && deps.underscore) ? deps.underscore : global._
+ ,Tweenable = (deps && deps.Tweenable) ? deps.Tweenable : global.Tweenable;
gk = global.Kapi;
actorCount = 0;
@@ -998,7 +1005,7 @@
var length = this.getEnd();
if (until <= length) {
- return;
+ return this;
}
this.copyProperties(until, length);
@@ -1048,6 +1055,14 @@
/**
+ * @return {number}
+ */
+ gk.Actor.prototype.getLength = function () {
+ return this.getEnd() - this.getStart();
+ }
+
+
+ /**
* @param {number} when
* @param {Object} stateModification
* @param {Object} opt_easingModification
@@ -1272,94 +1287,8 @@
* ...End Shifty interoperability methods.
*/
-} (this));
-;(function rekapiDOM (global) {
- var gk
- ,getStyle
- ,transforms;
-
- gk = global.Kapi;
- transforms = [
- 'transform'
- ,'webkitTransform'
- ,'MozTransform'
- ,'oTransform'
- ,'msTransform'];
-
- if (!global.getComputedStyle) {
- return;
- }
-
- function getStyle (forElement, styleName) {
- return global.getComputedStyle(forElement).getPropertyValue(styleName);
- }
-
- function setStyle (forElement, styleName, styleValue) {
- forElement.style[styleName] = styleValue;
- }
-
- function hideElement (element) {
- setStyle(element, 'display', 'none');
- }
-
- function showElement (element) {
- setStyle(element, 'display', 'block');
- }
-
- /**
- * @param {HTMLElement} element
- * @return {Kapi.DOMActor}
- */
- gk.DOMActor = function (element) {
- var actor;
-
- actor = new gk.Actor ({
- 'setup': function () {
- if (getStyle(this.kapi.canvas_getContext(), 'position') === 'static') {
- setStyle(this.kapi.canvas_getContext(), 'position', 'relative');
- }
-
- if (getStyle(element, 'position') === 'static') {
- setStyle(element, 'position', 'absolute');
- }
- }
-
- ,'draw': function (canvas_context, state) {
- var isShowing;
-
- isShowing = false;
-
- _.each(state, function (styleValue, styleName) {
- isShowing = true;
-
- if (styleName === 'rotate') {
- _.each(transforms, function (transform) {
- setStyle(element, transform, 'rotate(' + styleValue + 'deg)')
- });
- } else {
- setStyle(element, styleName, styleValue);
- }
- });
-
- isShowing ? showElement(element) : hideElement(element);
- }
- });
-
- actor.show = function (alsoPersist) {
- gk.Actor.prototype.show.call(this, alsoPersist);
- showElement(element);
- };
-
- actor.hide = function (alsoUnpersist) {
- gk.Actor.prototype.hide.call(this, alsoUnpersist);
- hideElement(element);
- };
-
- return actor;
- };
-
-}(this));
-;(function rekapiCanvas (global) {
+};
+var rekapiCanvas = function (global) {
var gk,
contextTypes = {
@@ -1481,11 +1410,13 @@
return this;
};
-} (this));
-;(function rekapiKeyframeProperty (global) {
+};
+var rekapiKeyframeProperty = function (global, deps) {
var gk
,DEFAULT_EASING = 'linear'
- ,KeyframePropertyMethods;
+ ,KeyframePropertyMethods
+ ,_ = (deps && deps.underscore) ? deps.underscore : global._
+ ,Tweenable = (deps && deps.Tweenable) ? deps.Tweenable : global.Tweenable;
gk = global.Kapi;
@@ -1576,4 +1507,394 @@
};
};
+};
+var rekapiDOM = function (global, deps) {
+ var gk = global.Kapi;
+ var _ = (deps && deps.underscore) ? deps.underscore : global._;
+ var transforms = [
+ 'transform'
+ ,'webkitTransform'
+ ,'MozTransform'
+ ,'oTransform'
+ ,'msTransform'];
+
+ if (!global.getComputedStyle) {
+ return;
+ }
+
+ function getStyle (forElement, styleName) {
+ return global.getComputedStyle(forElement).getPropertyValue(styleName);
+ }
+
+ function setStyle (forElement, styleName, styleValue) {
+ forElement.style[styleName] = styleValue;
+ }
+
+ function hideElement (element) {
+ setStyle(element, 'display', 'none');
+ }
+
+ function showElement (element) {
+ setStyle(element, 'display', 'block');
+ }
+
+ /**
+ * @param {HTMLElement} element
+ * @return {Kapi.Actor}
+ */
+ gk.DOMActor = function (element) {
+ var actor;
+
+ actor = new gk.Actor ({
+ 'setup': function () {
+ if (getStyle(this.kapi.canvas_getContext(), 'position') === 'static') {
+ setStyle(this.kapi.canvas_getContext(), 'position', 'relative');
+ }
+
+ if (getStyle(element, 'position') === 'static') {
+ setStyle(element, 'position', 'absolute');
+ }
+
+ this.hide();
+ }
+
+ ,'draw': function (canvas_context, state) {
+ var isShowing;
+
+ isShowing = false;
+
+ _.each(state, function (styleValue, styleName) {
+ isShowing = true;
+
+ if (styleName === 'rotate') {
+ _.each(transforms, function (transform) {
+ setStyle(element, transform, 'rotate(' + styleValue + 'deg)')
+ });
+ } else {
+ setStyle(element, styleName, styleValue);
+ }
+ });
+
+ isShowing ? this.show() : this.hide();
+ }
+ });
+
+ element.classList.add(actor.getCSSName());
+
+ actor.show = function (alsoPersist) {
+ gk.Actor.prototype.show.call(this, alsoPersist);
+ showElement(element);
+ };
+
+ actor.hide = function (alsoUnpersist) {
+ gk.Actor.prototype.hide.call(this, alsoUnpersist);
+ hideElement(element);
+ };
+
+ return actor;
+ };
+
+
+ /**
+ * @return {string}
+ */
+ global.Kapi.Actor.prototype.getCSSName = function () {
+ return 'actor-' + this.id;
+ };
+
+};
+var rekapiToCSS = function (Rekapi, global, deps) {
+
+ // CONSTANTS
+ //
+ var DEFAULT_GRANULARITY = 100;
+ var VENDOR_PREFIXES = Rekapi.util.VENDOR_PREFIXES = {
+ 'microsoft': '-ms-'
+ ,'mozilla': '-moz-'
+ ,'opera': '-o-'
+ ,'w3': ''
+ ,'webkit': '-webkit-'
+ };
+ var _ = (deps && deps.underscore) ? deps.underscore : global._;
+
+
+ // TEMPLATES
+ //
+
+ /**
+ * [0]: vendor
+ * [1]: animation name
+ * [2]: keyframes
+ */
+ var KEYFRAME_TEMPLATE = [
+ '@%skeyframes %s-keyframes {'
+ ,'%s'
+ ,'}'
+ ].join('\n');
+
+ /**
+ * [0] class name
+ * [1] class attributes
+ */
+ var CLASS_BOILERPLATE = [
+ '.%s {'
+ ,' position: absolute;'
+ ,'%s'
+ ,'}'
+ ].join('\n');
+
+
+ // PROTOTYPE EXTENSIONS
+ //
+ /**
+ * @param {Object} opts
+ */
+ global.Kapi.prototype.toCSS = function (opts) {
+ opts = opts || {};
+ var animationCSS = [];
+ var actorIds = this.getActorIds();
+
+ _.each(actorIds, function (id) {
+ animationCSS.push(this.getActor(id).toCSS(opts));
+ }, this);
+
+ return animationCSS.join('\n');
+ };
+
+
+ /**
+ * @param {Object} opts
+ */
+ global.Kapi.Actor.prototype.toCSS = function (opts) {
+ opts = opts || {};
+ var actorCSS = [];
+ var granularity = opts.granularity || DEFAULT_GRANULARITY;
+ var actorClass = generateCSSClass(this, opts.vendors);
+ actorCSS.push(actorClass);
+ var keyframes = generateActorKeyframes(this, granularity);
+ var boilerplatedKeyframes = applyVendorBoilerplates(
+ keyframes, this.getCSSName(), opts.vendors);
+ actorCSS.push(boilerplatedKeyframes);
+
+ return actorCSS.join('\n');
+ };
+
+
+ // UTILITY FUNCTIONS
+ //
+ /**
+ * @param {string} str
+ */
+ function isColorString (str) {
+ return /rgb/.test(str);
+ }
+
+
+ /**
+ * @param {Rekapi.Actor} actor
+ */
+ function serializeActorStep (actor) {
+ var serializedProps = ['{'];
+ var printVal;
+ _.each(actor.get(), function (val, key) {
+ if (isColorString(val)) {
+ printVal = val;
+ } else {
+ printVal = limitCSSPrecision(val, 2);
+ }
+ serializedProps.push(key + ':' + printVal + ';');
+ });
+
+ serializedProps.push('}');
+ return serializedProps.join('');
+ };
+
+
+ /**
+ * @param {Rekapi.Actor} actor
+ * @param {number} granularity
+ * @return {string}
+ */
+ function generateActorKeyframes (actor, granularity) {
+ var animLength = actor.getLength();
+ var i, delay = actor.getStart();
+ var serializedFrames = [];
+ var percent, stepPrefix;
+ var increment = animLength / granularity;
+ var animPercent = animLength / 100;
+
+
+ for (i = delay; i <= animLength + delay; i += increment) {
+ actor.calculatePosition(i);
+ percent = (i - delay) / animPercent;
+ if (percent === 0) {
+ stepPrefix = 'from ';
+ } else if (percent === 100) {
+ stepPrefix = 'to ';
+ } else {
+ stepPrefix = percent.toFixed(2) + '% ';
+ }
+ serializedFrames.push(' ' + stepPrefix + serializeActorStep(actor));
+ }
+
+ return serializedFrames.join('\n');
+ }
+
+
+ /**
+ * @param {string} toKeyframes Generated keyframes to wrap in boilerplates
+ * @param {string} animName
+ * @param {[string]} opt_vendors Vendor boilerplates to be applied. Should be
+ * any of the values in Rekapi.util.VENDOR_PREFIXES.
+ * @return {string}
+ */
+ function applyVendorBoilerplates (toKeyframes, animName, opt_vendors) {
+ opt_vendors = opt_vendors || ['w3'];
+ var renderedKeyframes = [];
+
+ _.each(opt_vendors, function (vendor) {
+ var renderedChunk = printf(KEYFRAME_TEMPLATE,
+ [VENDOR_PREFIXES[vendor], animName, toKeyframes]);
+
+ renderedKeyframes.push(renderedChunk);
+ });
+
+ return renderedKeyframes.join('\n');
+ }
+
+
+ /**
+ * @param {Rekapi.Actor} actor
+ * @param {[string]} opt_vendors
+ */
+ function generateCSSClass (actor, opt_vendors) {
+ opt_vendors = opt_vendors || ['w3'];
+ var classAttrs = [];
+ var vendorAttrs;
+
+ _.each(opt_vendors, function (vendor) {
+ vendorAttrs = generateCSSVendorAttributes(actor, vendor);
+ classAttrs.push(vendorAttrs);
+ });
+
+ var boilerplatedClass = printf(CLASS_BOILERPLATE
+ ,[actor.getCSSName(), classAttrs.join('\n')]);
+
+ return boilerplatedClass;
+ }
+
+
+ /**
+ * @param {Rekapi.Actor} actor
+ * @param {string} vendor
+ */
+ function generateCSSVendorAttributes (actor, vendor) {
+ var generatedAttributes = [];
+ var prefix = VENDOR_PREFIXES[vendor];
+ var start = actor.getStart();
+ var duration = actor.getEnd() - start;
+
+ var duration = printf(' %sanimation-duration: %sms;'
+ ,[prefix, duration]);
+ generatedAttributes.push(duration);
+
+ var animationName = printf(' %sanimation-name: %s;'
+ ,[prefix, actor.getCSSName() + '-keyframes']);
+ generatedAttributes.push(animationName);
+
+ var delay = printf(' %sanimation-delay: %sms;', [prefix, start]);
+ generatedAttributes.push(delay);
+
+ var fillMode = printf(' %sanimation-fill-mode: forwards;', [prefix]);
+ generatedAttributes.push(fillMode);
+
+ return generatedAttributes.join('\n');
+ }
+
+
+ /**
+ * @param {string} formatter
+ * @param {[string]} args
+ * @return {string}
+ */
+ var printf = Rekapi.util.printf = function (formatter, args) {
+ var composedStr = formatter;
+ _.each(args, function (arg) {
+ composedStr = composedStr.replace('%s', arg);
+ });
+
+ return composedStr;
+ };
+
+
+ /**
+ * @param {string} cssVal
+ * @param {number} precision
+ */
+ function limitCSSPrecision (cssVal, precision) {
+ var unit = cssVal.match(/\D*$/);
+ var val = parseFloat(cssVal);
+ return val.toFixed(precision) + unit;
+ }
+
+};
+var rekapi = function (global, deps) {
+ // If `deps` is defined, it means that Rekapi is loaded via AMD.
+ // Don't use global context in this case so that the global scope
+ // is not polluted by the Kapi object.
+ var context = deps ? {} : global;
+
+ rekapiCore(context, deps);
+ rekapiActor(context, deps);
+ rekapiCanvas(context, deps);
+ rekapiKeyframeProperty(context, deps);
+
+ // Extensions
+ if (typeof rekapiDOM === "function") {
+ rekapiDOM(context, deps);
+ }
+ if (typeof rekapiToCSS === "function") {
+ rekapiToCSS(context.Kapi, context, deps);
+ }
+
+ return context.Kapi;
+};
+
+
+if (typeof define === "function" && define.amd) {
+ var underscoreAlreadyInUse = (typeof _ !== 'undefined');
+
+ // Expose Rekapi as an AMD module if it's loaded with RequireJS or similar.
+ // Shifty and Underscore are set as dependencies of this module.
+ //
+ // The rekapi module is anonymous so that it can be required with any name.
+ // Example: define(['lib/rekapi.min'], function(Kapi) { ... });
+ define(['shifty', 'underscore'], function (Tweenable, Underscore) {
+ var underscoreSupportsAMD = (Underscore !== null)
+ ,deps = { Tweenable: Tweenable,
+ // Some versions of Underscore.js support AMD, others don't.
+ // If not, use the `_` global.
+ underscore: underscoreSupportsAMD ? Underscore : _ }
+ ,Kapi = rekapi(global, deps);
+
+ if (typeof KAPI_DEBUG !== 'undefined' && KAPI_DEBUG === true) {
+ Kapi.underscore_version = deps.underscore.VERSION;
+ }
+
+ if (!underscoreAlreadyInUse) {
+ // Prevent Underscore from polluting the global scope.
+ // This global can be safely removed since Rekapi keeps its own reference
+ // to Underscore via the `deps` object passed earlier as an argument.
+ delete global._;
+ }
+
+ return Kapi;
+ });
+} else {
+ // Load Rekapi normally (creating a Kapi global) if not using an AMD loader.
+
+ // Note: `global` is not defined when running unit tests. Pass `this` instead.
+ rekapi(typeof global !== 'undefined' ? global : this);
+}
+
} (this));
View
62 lib/rekapi.min.js
@@ -1,5 +1,5 @@
/**
- * Rekapi - Rewritten Kapi. v0.4.13
+ * Rekapi - Rewritten Kapi. v0.6.0
* By Jeremy Kahn - jeremyckahn@gmail.com
* https://github.com/jeremyckahn/rekapi
*
@@ -7,31 +7,35 @@
* Dependencies: Underscore.js (https://github.com/documentcloud/underscore), Shifty.js (https://github.com/jeremyckahn/shifty)
* MIT Lincense. This code free to use, modify, distribute and enjoy.
*/
-(function(f){function j(b){return b.sort(function(b,a){return b-a})}function e(b,a){return Math.floor(a/b._animationLength)}function i(b){return g()-b._loopTimestamp}function k(b,a){return a>=b._timesToIterate&&-1!==b._timesToIterate}function l(b,o){k(b,o)&&(b.stop(),a(b,"onAnimationComplete"))}function n(b,a,c){return k(b,c)?b._animationLength:a%b._animationLength}function h(b){var a=i(b),c;c=e(b,a);a=n(b,a,c);l(b,c);b.render(a)}function m(b){b._loopId=setTimeout(function(){m(b);h(b)},1E3/b.config.fps)}
-function a(b,a){_.each(b._events[a],function(a){a(b)})}var d={fps:30,height:150,width:300,doRoundNumbers:!1,clearOnUpdate:!0},g=Tweenable.util.now,c=f.Kapi||function(b,a){this.canvas=b;this._contextType=null;this.canvas_setContext(b);this.config={};this._actors={};this._drawOrder=[];this._playState="stopped";this._drawOrderSorter=null;this._events={onFrameRender:[],onAnimationComplete:[],onPlayStateChange:[],onPlay:[],onPause:[],onStop:[]};this._timesToIterate=-1;this._animationLength=0;this._pausedAtTime=
-this._loopTimestamp=this._loopId=null;this._lastRenderedMillisecond=0;_.extend(this.config,a);_.defaults(this.config,d);_.each(["height","width"],function(b){this.config[b]&&(this["canvas_"+b](this.config[b]),delete this.config[b])},this);return this};c.prototype.addActor=function(b){if(!_.contains(this._actors,b))b.kapi=this,b.fps=this.framerate(),this._actors[b.id]=b,this._drawOrder.push(b.id),b.setup();return this};c.prototype.getActor=function(b){return this._actors[b]};c.prototype.getActorIds=
-function(){return _.pluck(this._actors,"id")};c.prototype.getAllActors=function(){return _.clone(this._actors)};c.prototype.removeActor=function(b){delete this._actors[b.id];delete b.kapi;this._drawOrder=_.without(this._drawOrder,b.id);b.teardown();this.updateInternalState();return this};c.prototype.play=function(b){clearTimeout(this._loopId);this._loopTimestamp="paused"===this._playState?this._loopTimestamp+(g()-this._pausedAtTime):g();this._timesToIterate=b||-1;this._playState="playing";m(this);
-_.each(this._actors,function(b){b._state.isPaused&&b.resume()});a(this,"onPlayStateChange");a(this,"onPlay");return this};c.prototype.playFrom=function(b,a){this.play(a);this._loopTimestamp=g()-b;return this};c.prototype.playFromCurrent=function(b){return this.playFrom(this._lastRenderedMillisecond,b)};c.prototype.pause=function(){if("paused"===this._playState)return this;this._playState="paused";clearTimeout(this._loopId);this._pausedAtTime=g();_.each(this._actors,function(b){b._state.isTweening&&
-b.pause()});a(this,"onPlayStateChange");a(this,"onPause");return this};c.prototype.stop=function(b){this._playState="stopped";clearTimeout(this._loopId);!0===b&&this.canvas_clear();_.each(this._actors,function(a){a.stop();!0===b&&a.hide()});a(this,"onPlayStateChange");a(this,"onStop");return this};c.prototype.isPlaying=function(){return"playing"===this._playState};c.prototype.animationLength=function(){return this._animationLength};c.prototype.lastPositionRendered=function(){return this._lastRenderedMillisecond/
-this._animationLength};c.prototype.actorCount=function(){return this._drawOrder.length};c.prototype.framerate=function(b){if(b)this.config.fps=b;return this.config.fps};c.prototype.render=function(b){this.calculateActorPositions(b);this.draw();this._lastRenderedMillisecond=b;a(this,"onFrameRender");return this};c.prototype.redraw=function(){this.render(this._lastRenderedMillisecond);return this};c.prototype.calculateActorPositions=function(b){var a,c,d;d=Tweenable.util.isRoundingEnabled();this.config.doRoundNumbers?
-Tweenable.util.enableRounding():Tweenable.util.disableRounding();c=this._drawOrder.length;for(a=0;a<c;a++)this._actors[this._drawOrder[a]].calculatePosition(b);!0===d?Tweenable.util.enableRounding():Tweenable.util.disableRounding();return this};c.prototype.draw=function(){var b,a,c,d,g;this.config.clearOnUpdate&&this.canvas_clear();a=this._drawOrder.length;d=this.canvas_getContext();this._drawOrderSorter?(b=_.sortBy(this._actors,this._drawOrderSorter),g=_.pluck(b,"id")):g=this._drawOrder;for(b=0;b<
-a;b++)c=this._actors[g[b]],c.isShowing()&&c.draw(d,c.get());return this};c.prototype.updateInternalState=function(){var a=[];_.each(this._actors,function(c){a.push(c.getEnd())});this._animationLength=Math.max.apply(Math,a);return this};c.prototype.moveActorToLayer=function(a,c){if(c<this._drawOrder.length)return this._drawOrder=_.without(this._drawOrder,a.id),this._drawOrder.splice(c,0,a.id),a};c.prototype.bind=function(a,c){if(this._events[a])return this._events[a].push(c),this};c.prototype.unbind=
-function(a,c){if(this._events[a])return this._events[a]=c?_.without(this._events[a],c):[],this};c.prototype.setOrderFunction=function(a){this._drawOrderSorter=a;return this};c.prototype.unsetOrderFunction=function(){this._drawOrderSorter=null;return this};c.prototype.exportTimeline=function(){var a={duration:this._animationLength,actorOrder:this._drawOrder.slice(0),actors:{}};_.each(this._drawOrder,function(c){a.actors[c]=this._actors[c].exportTimeline()},this);return a};c.util={};_.extend(c.util,
-{noop:function(){},sortNumerically:j,calculateLoopPosition:n,calculateTimeSinceStart:i});if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)c._private={sortNumerically:j,calculateLoopPosition:n,renderCurrentMillisecond:h,tick:m,determineCurrentLoopIteration:e,calculateTimeSinceStart:i,isAnimationComplete:k,updatePlayState:l};f.Rekapi=f.Kapi=c})(this);
-(function(f){function j(a,d){var g,c,b;b=a._timelinePropertyCacheIndex;c=b.length;for(g=1;g<c;g++)if(b[g]>=d)return g-1;return-1}function e(a){_.each(a._propertyTracks,function(d,g){a._propertyTracks[g]=_.sortBy(a._propertyTracks[g],function(a){return a.millisecond})})}function i(a){_.each(a._timelinePropertyCaches,function(d,g){var c={};_.each(a._propertyTracks,function(a,d){var e=null;_.find(a,function(a){a.millisecond>g&&(c[d]=e);e=a;return!!c[d]})});_.defaults(d,c)})}function k(a){_.each(a._propertyTracks,
-function(a){_.each(a,function(g,c){g.linkToNext(a[c+1])})})}function l(a,d,g){return _.find(a._propertyTracks[d],function(a){return a.millisecond===g})}function n(a,d,g,c){var b=_.keys(a._propertyTracks),e=_.keys(d),b=_.difference(b,e),h={};_.each(b,function(b){var d;d=a._propertyTracks[b].slice(0).reverse();_.each(d,function(a){a.millisecond<c&&!h[b]&&(h[b]={value:a.value,easing:a.easing})})});_.each(h,function(a,b){d[b]=a.value;g[b]=a.easing})}var h,m;h=f.Kapi;m=0;h.Actor=function(a){a=a||{};this.constructor.call(this);
-_.extend(this,{_data:{},_propertyTracks:{},_timelinePropertyCaches:{},_timelinePropertyCacheIndex:[],_keyframeProperties:{},_isShowing:!1,_isPersisting:!1,id:m++,setup:a.setup||h.util.noop,draw:a.draw||h.util.noop,teardown:a.teardown||h.util.noop});return this};f=function(){};f.prototype=Tweenable.prototype;h.Actor.prototype=new f;h.Actor.prototype.keyframe=function(a,d,g){var c;g||(g="linear");"string"===typeof g&&(c=g,g={},_.each(d,function(a,d){g[d]=c}));_.each(d,function(a,c){g[c]=g[c]||"linear"});
-n(this,d,g,a);_.each(d,function(b,c){var d;d=new h.KeyframeProperty(this,a,c,b,g[c]);this._keyframeProperties[d.id]=d;this._propertyTracks[c]||(this._propertyTracks[c]=[]);this._propertyTracks[c].push(d);e(this)},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};h.Actor.prototype.getKeyframeProperty=function(a,d){if(this._propertyTracks[a]&&this._propertyTracks[a][d])return this._propertyTracks[a][d]};h.Actor.prototype.modifyKeyframeProperty=function(a,d,g){this._propertyTracks[a]&&
-this._propertyTracks[a][d]&&this._propertyTracks[a][d].modifyWith(g);e(this);this.invalidatePropertyCache();return this};h.Actor.prototype.getTrackNames=function(){return _.keys(this._propertyTracks)};h.Actor.prototype.getTrackLength=function(a){return!this._propertyTracks[a]?void 0:this._propertyTracks[a].length};h.Actor.prototype.copyProperties=function(a,d){var g,c;g={};c={};_.each(this._propertyTracks,function(a,e){var h;if(h=l(this,e,d))g[e]=h.value,c[e]=h.easing},this);this.keyframe(a,g,c);
-return this};h.Actor.prototype.wait=function(a){var d=this.getEnd();if(!(a<=d))return this.copyProperties(a,d),this};h.Actor.prototype.getStart=function(){var a=[];_.each(this._propertyTracks,function(d){d.length&&a.push(d[0].millisecond)});0===a.length&&(a=[0]);return Math.min.apply(Math,a)};h.Actor.prototype.getEnd=function(){var a=0;_.each(this._propertyTracks,function(d){if(d.length)d=_.last(d).millisecond,d>a&&(a=d)},this);return a};h.Actor.prototype.modifyKeyframe=function(a,d,g){g=g||{};_.each(this._propertyTracks,
-function(c,b){var e=l(this,b,a);e&&e.modifyWith({value:d[b],easing:g[b]})},this);return this};h.Actor.prototype.removeKeyframe=function(a){_.each(this._propertyTracks,function(d){var g=-1;_.find(d,function(c){g++;return a===c.millisecond});(d=d.splice(g,1)[0])&&delete this._keyframeProperties[d.id]},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};h.Actor.prototype.removeAllKeyframeProperties=function(){_.each(this._propertyTracks,function(a){a.length=0},this);this._keyframeProperties=
-{};return this.removeKeyframe(0)};h.Actor.prototype.moveToLayer=function(a){return this.kapi.moveActorToLayer(this,a)};h.Actor.prototype.show=function(a){this._isShowing=!0;this._isPersisting=!!a;return this};h.Actor.prototype.hide=function(a){this._isShowing=!1;if(!0===a)this._isPersisting=!1;return this};h.Actor.prototype.isShowing=function(){return this._isShowing||this._isPersisting};h.Actor.prototype.calculatePosition=function(a){var d,g,c;d=this.getStart();g=this.getEnd();this.hide();d<=a&&
-a<=g&&(this.show(),d=j(this,a),d=this._timelinePropertyCaches[this._timelinePropertyCacheIndex[d]],c={},_.each(d,function(b,d){c[d]=b.getValueAt(a)}),this.set(c));return this};h.Actor.prototype.data=function(a){if(a)this._data=a;return this._data};h.Actor.prototype.exportTimeline=function(){var a={start:this.getStart(),end:this.getEnd(),trackNames:this.getTrackNames(),propertyTracks:{}};_.each(this._propertyTracks,function(d,g){var c=a.propertyTracks[g]=[];_.each(d,function(a){c.push(a.exportPropertyData())})});
-return a};h.Actor.prototype.invalidatePropertyCache=function(){this._timelinePropertyCaches={};_.each(this._keyframeProperties,function(a){this._timelinePropertyCaches[a.millisecond]||(this._timelinePropertyCaches[a.millisecond]={});this._timelinePropertyCaches[a.millisecond][a.name]=a},this);this._timelinePropertyCacheIndex=_.keys(this._timelinePropertyCaches);_.each(this._timelinePropertyCacheIndex,function(a,d){this._timelinePropertyCacheIndex[d]=+a},this);h.util.sortNumerically(this._timelinePropertyCacheIndex);
-i(this);k(this)};_.each(["tween","to"],function(a){h.Actor.prototype[a]=function(){this.show(!0);Tweenable.prototype[a].apply(this,arguments)}},this)})(this);
-(function(f){var j,e;j=f.Kapi;e=["transform","webkitTransform","MozTransform","oTransform","msTransform"];if(f.getComputedStyle)j.DOMActor=function(i){var k;k=new j.Actor({setup:function(){var e=this.kapi.canvas_getContext();"static"===f.getComputedStyle(e).getPropertyValue("position")&&(this.kapi.canvas_getContext().style.position="relative");"static"===f.getComputedStyle(i).getPropertyValue("position")&&(i.style.position="absolute")},draw:function(f,j){var h;h=!1;_.each(j,function(f,a){h=!0;"rotate"===
-a?_.each(e,function(a){i.style[a]="rotate("+f+"deg)"}):i.style[a]=f});i.style.display=h?"block":"none"}});k.show=function(e){j.Actor.prototype.show.call(this,e);i.style.display="block"};k.hide=function(e){j.Actor.prototype.hide.call(this,e);i.style.display="none"};return k}})(this);
-(function(f){function j(e,f,j,l){if("undefined"!==typeof l){e[j]=l;if(!e.style)e.style={};e.style[j]=l+"px"}return f===f.HTML_ELEMENT?e.style[j]:e[j]}f=f.Kapi;f.prototype.canvas_setContext=function(e){var f;this._canvas=e;f=e.nodeName;void 0===f?(this._context={},this._contextType="other"):"CANVAS"===f?(this._context=e.getContext("2d"),this._contextType="canvas"):(this._context=e,this._contextType="HTMLElement");return this.canvas_getContext()};f.prototype.canvas_getContext=function(){return this._context};
-f.prototype.canvas_height=function(e){return j(this.canvas,this._contextType,"height",e)};f.prototype.canvas_width=function(e){return j(this.canvas,this._contextType,"width",e)};f.prototype.canvas_style=function(e,f){"undefined"!==typeof f&&this.canvas.style&&(this.canvas.style[e]=f);return this.canvas.style[e]};f.prototype.canvas_clear=function(){"canvas"===this._contextType&&this.canvas_getContext().clearRect(0,0,this.canvas_width(),this.canvas_height());return this}})(this);
-(function(f){f=f.Kapi;f.KeyframeProperty=function(f,e,i,k,l){this.id=_.uniqueId("keyframeProperty_");this.ownerActor=f;this.millisecond=e;this.name=i;this.value=k;this.easing=l||"linear";this.nextProperty=null;return this};f.KeyframeProperty.prototype.modifyWith=function(f){var e={};_.each(["millisecond","easing","value"],function(i){e[i]="undefined"===typeof f[i]?this[i]:f[i]},this);_.extend(this,e)};f.KeyframeProperty.prototype.linkToNext=function(f){this.nextProperty=f||null};f.KeyframeProperty.prototype.getValueAt=
-function(f){var e,i,k;e={};i={};this.nextProperty?(e[this.name]=this.value,i[this.name]=this.nextProperty.value,k=this.nextProperty.millisecond-this.millisecond,f=(f-this.millisecond)/k,e=Tweenable.util.interpolate(e,i,f,this.nextProperty.easing)[this.name]):e=null;return e};f.KeyframeProperty.prototype.exportPropertyData=function(){return{id:this.id,millisecond:this.millisecond,name:this.name,value:this.value,easing:this.easing}}})(this);
+(function(r){var v=function(h,f){function c(b){return b.sort(function(b,a){return b-a})}function l(b,a){return Math.floor(a/b._animationLength)}function m(b){return e()-b._loopTimestamp}function n(b,a){return a>=b._timesToIterate&&-1!==b._timesToIterate}function k(b,a){n(b,a)&&(b.stop(),j(b,"onAnimationComplete"))}function o(b,a,d){return n(b,d)?b._animationLength:a%b._animationLength}function i(b){var a=m(b),d;d=l(b,a);a=o(b,a,d);b.render(a);k(b,d)}function p(b){b._loopId=setTimeout(function(){p(b);
+i(b)},1E3/b.config.fps)}function j(b,a){g.each(b._events[a],function(a){a(b)})}var g=f&&f.underscore?f.underscore:h._,q=f&&f.Tweenable?f.Tweenable:h.Tweenable,a={fps:30,height:150,width:300,doRoundNumbers:!1,clearOnUpdate:!0},e=q.util.now,d=h.Kapi||function(b,d){this.canvas=b;this._contextType=null;this.canvas_setContext(b);this.config={};this._actors={};this._drawOrder=[];this._playState="stopped";this._drawOrderSorter=null;this._events={onFrameRender:[],onAnimationComplete:[],onPlayStateChange:[],
+onPlay:[],onPause:[],onStop:[]};this._timesToIterate=-1;this._animationLength=0;this._pausedAtTime=this._loopTimestamp=this._loopId=null;this._lastRenderedMillisecond=0;g.extend(this.config,d);g.defaults(this.config,a);g.each(["height","width"],function(b){this.config[b]&&(this["canvas_"+b](this.config[b]),delete this.config[b])},this);return this};d.prototype.addActor=function(b){if(!g.contains(this._actors,b))b.kapi=this,b.fps=this.framerate(),this._actors[b.id]=b,this._drawOrder.push(b.id),b.setup();
+return this};d.prototype.getActor=function(b){return this._actors[b]};d.prototype.getActorIds=function(){return g.pluck(this._actors,"id")};d.prototype.getAllActors=function(){return g.clone(this._actors)};d.prototype.removeActor=function(b){delete this._actors[b.id];delete b.kapi;this._drawOrder=g.without(this._drawOrder,b.id);b.teardown();this.updateInternalState();return this};d.prototype.play=function(b){clearTimeout(this._loopId);this._loopTimestamp="paused"===this._playState?this._loopTimestamp+
+(e()-this._pausedAtTime):e();this._timesToIterate=b||-1;this._playState="playing";p(this);g.each(this._actors,function(b){b._state.isPaused&&b.resume()});j(this,"onPlayStateChange");j(this,"onPlay");return this};d.prototype.playFrom=function(b,a){this.play(a);this._loopTimestamp=e()-b;return this};d.prototype.playFromCurrent=function(b){return this.playFrom(this._lastRenderedMillisecond,b)};d.prototype.pause=function(){if("paused"===this._playState)return this;this._playState="paused";clearTimeout(this._loopId);
+this._pausedAtTime=e();g.each(this._actors,function(b){b._state.isTweening&&b.pause()});j(this,"onPlayStateChange");j(this,"onPause");return this};d.prototype.stop=function(b){this._playState="stopped";clearTimeout(this._loopId);!0===b&&this.canvas_clear();g.each(this._actors,function(a){a.stop();!0===b&&a.hide()});j(this,"onPlayStateChange");j(this,"onStop");return this};d.prototype.isPlaying=function(){return"playing"===this._playState};d.prototype.animationLength=function(){return this._animationLength};
+d.prototype.lastPositionRendered=function(){return this._lastRenderedMillisecond/this._animationLength};d.prototype.actorCount=function(){return this._drawOrder.length};d.prototype.framerate=function(b){if(b)this.config.fps=b;return this.config.fps};d.prototype.render=function(b){this.calculateActorPositions(b);this.draw();this._lastRenderedMillisecond=b;j(this,"onFrameRender");return this};d.prototype.redraw=function(){this.render(this._lastRenderedMillisecond);return this};d.prototype.calculateActorPositions=
+function(b){var a,d,e;e=q.util.isRoundingEnabled();this.config.doRoundNumbers?q.util.enableRounding():q.util.disableRounding();d=this._drawOrder.length;for(a=0;a<d;a++)this._actors[this._drawOrder[a]].calculatePosition(b);!0===e?q.util.enableRounding():q.util.disableRounding();return this};d.prototype.draw=function(){var b,a,d,e,c;this.config.clearOnUpdate&&this.canvas_clear();a=this._drawOrder.length;e=this.canvas_getContext();this._drawOrderSorter?(b=g.sortBy(this._actors,this._drawOrderSorter),
+c=g.pluck(b,"id")):c=this._drawOrder;for(b=0;b<a;b++)d=this._actors[c[b]],d.isShowing()&&d.draw(e,d.get());return this};d.prototype.updateInternalState=function(){var b=[];g.each(this._actors,function(a){b.push(a.getEnd())});this._animationLength=Math.max.apply(Math,b);return this};d.prototype.moveActorToLayer=function(b,a){if(a<this._drawOrder.length)return this._drawOrder=g.without(this._drawOrder,b.id),this._drawOrder.splice(a,0,b.id),b};d.prototype.bind=function(b,a){if(this._events[b])return this._events[b].push(a),
+this};d.prototype.unbind=function(b,a){if(this._events[b])return this._events[b]=a?g.without(this._events[b],a):[],this};d.prototype.setOrderFunction=function(a){this._drawOrderSorter=a;return this};d.prototype.unsetOrderFunction=function(){this._drawOrderSorter=null;return this};d.prototype.exportTimeline=function(){var a={duration:this._animationLength,actorOrder:this._drawOrder.slice(0),actors:{}};g.each(this._drawOrder,function(d){a.actors[d]=this._actors[d].exportTimeline()},this);return a};
+d.util={};g.extend(d.util,{noop:function(){},sortNumerically:c,calculateLoopPosition:o,calculateTimeSinceStart:m});if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)d._private={sortNumerically:c,calculateLoopPosition:o,renderCurrentMillisecond:i,tick:p,determineCurrentLoopIteration:l,calculateTimeSinceStart:m,isAnimationComplete:n,updatePlayState:k};h.Rekapi=h.Kapi=d},w=function(h,f){function c(a,e){var d,b,g;g=a._timelinePropertyCacheIndex;b=g.length;for(d=1;d<b;d++)if(g[d]>=e)return d-1;return-1}
+function l(a){g.each(a._propertyTracks,function(e,d){a._propertyTracks[d]=g.sortBy(a._propertyTracks[d],function(a){return a.millisecond})})}function m(a){g.each(a._timelinePropertyCaches,function(e,d){var b={};g.each(a._propertyTracks,function(a,e){var c=null;g.find(a,function(a){a.millisecond>d&&(b[e]=c);c=a;return!!b[e]})});g.defaults(e,b)})}function n(a){g.each(a._propertyTracks,function(a){g.each(a,function(d,b){d.linkToNext(a[b+1])})})}function k(a,e,d){return g.find(a._propertyTracks[e],function(a){return a.millisecond===
+d})}function o(a,e,d,b){var c=g.keys(a._propertyTracks),f=g.keys(e),c=g.difference(c,f),i={};g.each(c,function(d){var e;e=a._propertyTracks[d].slice(0).reverse();g.each(e,function(a){a.millisecond<b&&!i[d]&&(i[d]={value:a.value,easing:a.easing})})});g.each(i,function(a,b){e[b]=a.value;d[b]=a.easing})}var i,p,j,g=f&&f.underscore?f.underscore:h._,q=f&&f.Tweenable?f.Tweenable:h.Tweenable;i=h.Kapi;p=0;i.Actor=function(a){a=a||{};this.constructor.call(this);g.extend(this,{_data:{},_propertyTracks:{},_timelinePropertyCaches:{},
+_timelinePropertyCacheIndex:[],_keyframeProperties:{},_isShowing:!1,_isPersisting:!1,id:p++,setup:a.setup||i.util.noop,draw:a.draw||i.util.noop,teardown:a.teardown||i.util.noop});return this};j=function(){};j.prototype=q.prototype;i.Actor.prototype=new j;i.Actor.prototype.keyframe=function(a,e,d){var b;d||(d="linear");"string"===typeof d&&(b=d,d={},g.each(e,function(a,e){d[e]=b}));g.each(e,function(a,b){d[b]=d[b]||"linear"});o(this,e,d,a);g.each(e,function(b,e){var g;g=new i.KeyframeProperty(this,
+a,e,b,d[e]);this._keyframeProperties[g.id]=g;this._propertyTracks[e]||(this._propertyTracks[e]=[]);this._propertyTracks[e].push(g);l(this)},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};i.Actor.prototype.getKeyframeProperty=function(a,e){if(this._propertyTracks[a]&&this._propertyTracks[a][e])return this._propertyTracks[a][e]};i.Actor.prototype.modifyKeyframeProperty=function(a,e,d){this._propertyTracks[a]&&this._propertyTracks[a][e]&&this._propertyTracks[a][e].modifyWith(d);
+l(this);this.invalidatePropertyCache();return this};i.Actor.prototype.getTrackNames=function(){return g.keys(this._propertyTracks)};i.Actor.prototype.getTrackLength=function(a){return!this._propertyTracks[a]?void 0:this._propertyTracks[a].length};i.Actor.prototype.copyProperties=function(a,e){var d,b;d={};b={};g.each(this._propertyTracks,function(a,g){var c;if(c=k(this,g,e))d[g]=c.value,b[g]=c.easing},this);this.keyframe(a,d,b);return this};i.Actor.prototype.wait=function(a){var e=this.getEnd();if(a<=
+e)return this;this.copyProperties(a,e);return this};i.Actor.prototype.getStart=function(){var a=[];g.each(this._propertyTracks,function(e){e.length&&a.push(e[0].millisecond)});0===a.length&&(a=[0]);return Math.min.apply(Math,a)};i.Actor.prototype.getEnd=function(){var a=0;g.each(this._propertyTracks,function(e){if(e.length)e=g.last(e).millisecond,e>a&&(a=e)},this);return a};i.Actor.prototype.getLength=function(){return this.getEnd()-this.getStart()};i.Actor.prototype.modifyKeyframe=function(a,e,d){d=
+d||{};g.each(this._propertyTracks,function(b,g){var c=k(this,g,a);c&&c.modifyWith({value:e[g],easing:d[g]})},this);return this};i.Actor.prototype.removeKeyframe=function(a){g.each(this._propertyTracks,function(e){var d=-1;g.find(e,function(b){d++;return a===b.millisecond});(e=e.splice(d,1)[0])&&delete this._keyframeProperties[e.id]},this);this.kapi.updateInternalState();this.invalidatePropertyCache();return this};i.Actor.prototype.removeAllKeyframeProperties=function(){g.each(this._propertyTracks,
+function(a){a.length=0},this);this._keyframeProperties={};return this.removeKeyframe(0)};i.Actor.prototype.moveToLayer=function(a){return this.kapi.moveActorToLayer(this,a)};i.Actor.prototype.show=function(a){this._isShowing=!0;this._isPersisting=!!a;return this};i.Actor.prototype.hide=function(a){this._isShowing=!1;if(!0===a)this._isPersisting=!1;return this};i.Actor.prototype.isShowing=function(){return this._isShowing||this._isPersisting};i.Actor.prototype.calculatePosition=function(a){var e,d,
+b;e=this.getStart();d=this.getEnd();this.hide();e<=a&&a<=d&&(this.show(),e=c(this,a),e=this._timelinePropertyCaches[this._timelinePropertyCacheIndex[e]],b={},g.each(e,function(d,e){b[e]=d.getValueAt(a)}),this.set(b));return this};i.Actor.prototype.data=function(a){if(a)this._data=a;return this._data};i.Actor.prototype.exportTimeline=function(){var a={start:this.getStart(),end:this.getEnd(),trackNames:this.getTrackNames(),propertyTracks:{}};g.each(this._propertyTracks,function(e,d){var b=a.propertyTracks[d]=
+[];g.each(e,function(a){b.push(a.exportPropertyData())})});return a};i.Actor.prototype.invalidatePropertyCache=function(){this._timelinePropertyCaches={};g.each(this._keyframeProperties,function(a){this._timelinePropertyCaches[a.millisecond]||(this._timelinePropertyCaches[a.millisecond]={});this._timelinePropertyCaches[a.millisecond][a.name]=a},this);this._timelinePropertyCacheIndex=g.keys(this._timelinePropertyCaches);g.each(this._timelinePropertyCacheIndex,function(a,e){this._timelinePropertyCacheIndex[e]=
++a},this);i.util.sortNumerically(this._timelinePropertyCacheIndex);m(this);n(this)};g.each(["tween","to"],function(a){i.Actor.prototype[a]=function(){this.show(!0);q.prototype[a].apply(this,arguments)}},this)},x=function(h){function f(c,f,h,n){if("undefined"!==typeof n){c[h]=n;if(!c.style)c.style={};c.style[h]=n+"px"}return f===f.HTML_ELEMENT?c.style[h]:c[h]}h=h.Kapi;h.prototype.canvas_setContext=function(c){var f;this._canvas=c;f=c.nodeName;void 0===f?(this._context={},this._contextType="other"):
+"CANVAS"===f?(this._context=c.getContext("2d"),this._contextType="canvas"):(this._context=c,this._contextType="HTMLElement");return this.canvas_getContext()};h.prototype.canvas_getContext=function(){return this._context};h.prototype.canvas_height=function(c){return f(this.canvas,this._contextType,"height",c)};h.prototype.canvas_width=function(c){return f(this.canvas,this._contextType,"width",c)};h.prototype.canvas_style=function(c,f){"undefined"!==typeof f&&this.canvas.style&&(this.canvas.style[c]=
+f);return this.canvas.style[c]};h.prototype.canvas_clear=function(){"canvas"===this._contextType&&this.canvas_getContext().clearRect(0,0,this.canvas_width(),this.canvas_height());return this}},y=function(h,f){var c,l=f&&f.underscore?f.underscore:h._,m=f&&f.Tweenable?f.Tweenable:h.Tweenable;c=h.Kapi;c.KeyframeProperty=function(c,f,h,i,p){this.id=l.uniqueId("keyframeProperty_");this.ownerActor=c;this.millisecond=f;this.name=h;this.value=i;this.easing=p||"linear";this.nextProperty=null;return this};
+c.KeyframeProperty.prototype.modifyWith=function(c){var f={};l.each(["millisecond","easing","value"],function(h){f[h]="undefined"===typeof c[h]?this[h]:c[h]},this);l.extend(this,f)};c.KeyframeProperty.prototype.linkToNext=function(c){this.nextProperty=c||null};c.KeyframeProperty.prototype.getValueAt=function(c){var f,h,i;f={};h={};this.nextProperty?(f[this.name]=this.value,h[this.name]=this.nextProperty.value,i=this.nextProperty.millisecond-this.millisecond,c=(c-this.millisecond)/i,f=m.util.interpolate(f,
+h,c,this.nextProperty.easing)[this.name]):f=null;return f};c.KeyframeProperty.prototype.exportPropertyData=function(){return{id:this.id,millisecond:this.millisecond,name:this.name,value:this.value,easing:this.easing}}},s=function(h,f){var c=h.Kapi,l=f&&f.underscore?f.underscore:h._,m=["transform","webkitTransform","MozTransform","oTransform","msTransform"];if(h.getComputedStyle)c.DOMActor=function(f){var k;k=new c.Actor({setup:function(){var c=this.kapi.canvas_getContext();"static"===h.getComputedStyle(c).getPropertyValue("position")&&
+(this.kapi.canvas_getContext().style.position="relative");"static"===h.getComputedStyle(f).getPropertyValue("position")&&(f.style.position="absolute");this.hide()},draw:function(c,h){var k;k=!1;l.each(h,function(c,g){k=!0;"rotate"===g?l.each(m,function(g){f.style[g]="rotate("+c+"deg)"}):f.style[g]=c});k?this.show():this.hide()}});f.classList.add(k.getCSSName());k.show=function(h){c.Actor.prototype.show.call(this,h);f.style.display="block"};k.hide=function(h){c.Actor.prototype.hide.call(this,h);f.style.display=
+"none"};return k},h.Kapi.Actor.prototype.getCSSName=function(){return"actor-"+this.id}},t=function(h,f,c){function l(g){var c=["{"],a;o.each(g.get(),function(e,d){var b;/rgb/.test(e)?b=e:(b=e.match(/\D*$/),b=parseFloat(e).toFixed(2)+b);a=b;c.push(d+":"+a+";")});c.push("}");return c.join("")}function m(g,c,a){var a=a||["w3"],e=[];o.each(a,function(a){a=j(i,[k[a],c,g]);e.push(a)});return e.join("\n")}function n(g,c){var c=c||["w3"],a=[],e;o.each(c,function(d){var b=[],d=k[d],c=g.getStart(),f=g.getEnd()-
+c,f=j(" %sanimation-duration: %sms;",[d,f]);b.push(f);f=j(" %sanimation-name: %s;",[d,g.getCSSName()+"-keyframes"]);b.push(f);c=j(" %sanimation-delay: %sms;",[d,c]);b.push(c);d=j(" %sanimation-fill-mode: forwards;",[d]);b.push(d);e=b.join("\n");a.push(e)});return j(p,[g.getCSSName(),a.join("\n")])}var k=h.util.VENDOR_PREFIXES={microsoft:"-ms-",mozilla:"-moz-",opera:"-o-",w3:"",webkit:"-webkit-"},o=c&&c.underscore?c.underscore:f._,i="@%skeyframes %s-keyframes {\n%s\n}",p=".%s {\n position: absolute;\n%s\n}";
+f.Kapi.prototype.toCSS=function(c){var c=c||{},f=[],a=this.getActorIds();o.each(a,function(a){f.push(this.getActor(a).toCSS(c))},this);return f.join("\n")};f.Kapi.Actor.prototype.toCSS=function(c){var c=c||{},f=[],a=c.granularity||100,e=n(this,c.vendors);f.push(e);for(var e=this.getLength(),d=this.getStart(),b=[],h,i=e/a,j=e/100,a=d;a<=e+d;a+=i)this.calculatePosition(a),h=(a-d)/j,h=0===h?"from ":100===h?"to ":h.toFixed(2)+"% ",b.push(" "+h+l(this));e=b.join("\n");c=m(e,this.getCSSName(),c.vendors);
+f.push(c);return f.join("\n")};var j=h.util.printf=function(c,f){var a=c;o.each(f,function(c){a=a.replace("%s",c)});return a}},u=function(h,f){var c=f?{}:h;v(c,f);w(c,f);x(c,f);y(c,f);"function"===typeof s&&s(c,f);"function"===typeof t&&t(c.Kapi,c,f);return c.Kapi};if("function"===typeof define&&define.amd){var z="undefined"!==typeof _;define(["shifty","underscore"],function(h,f){var c={Tweenable:h,underscore:null!==f?f:_},l=u(r,c);if("undefined"!==typeof KAPI_DEBUG&&!0===KAPI_DEBUG)l.underscore_version=
+c.underscore.VERSION;z||delete r._;return l})}else u("undefined"!==typeof r?r:this)})(this);
Please sign in to comment.
Something went wrong with that request. Please try again.