This commit is contained in:
thednp 2016-02-06 00:19:14 +02:00
parent b3be076328
commit ca7fc23fcc
7 changed files with 14 additions and 14 deletions

View file

@ -86,7 +86,7 @@ $ bower install --save kute.js
<h2>Main Methods</h2>
<p>These methods allow you to create <strong>tween objects</strong> and collections of <strong>tween objects</strong>; as we know, a tween object is essentially like an animation setup for a given HTML element, defining CSS properties, animation duration, repeat or other options. The methods have different uses and performance scores while making it easy to work with.</p>
<h3>Single Tween Object Construct</h3>
<h3>Single Tween Object</h3>
<p>As the heading suggests, the following two methods allow you to create tween objects for a single HTML element, except when used in combination with jQuery and the KUTE.js plugin for jQuery, where, as jQuery always does, it always works with collections of elements.</p>
<p><kbd>.to()</kbd> method is the most simple method which allows you to create tween objects for animating CSS properties from a specific default value OR from current/computed value TO a desired value.
It's performance is not the same as for the <strong>.fromTo()</strong> method as it has to compute the default/current value on tween <code>.start()</code> and thus delays the animation for a couple of miliseconds; still this feature is great for simple animations AND it has the ability to stack transform properties as they go, making smooth transform animations on chained tweens. See the <a href="#start">.start()</a> method for the solution for sync/delay issue.</p>
@ -96,8 +96,8 @@ $ bower install --save kute.js
<p><kbd>.fromTo()</kbd> method is the best way to build animations for BEST performance and absolute control. The tests prove this method to be the fastest method but unlike the <code>.to()</code> method, it does not stack transform properties on chained tweens. Along with the performance advantage, you can set measurement units for both starting and end values, to avoid glitches. We've talked about this in the <a href="features.html">features page</a>. Here's a quick example:</p>
<pre><code class="language-javascript">KUTE.fromTo(div,{opacity:1},{opacity:0}).start()</code></pre>
<h3>Multiple Tween Object Construct</h3>
<p>These methods allow you to create animations for multiple HTML elements at the same time, all in a single line of code. They use the above methods to create a tween object for each element of the collection and also enable the tween control methods in this new context.</p>
<h3>Tween Object Collections</h3>
<p>The two new methods allow you to create animations for multiple HTML elements at the same time, all in a single line of code. They use the above methods to create a tween object for each element of the collection and also enable the tween control methods in this new context.</p>
<p><kbd>.allTo()</kbd> method allows you to create an array of tween objects for a collection of elements. This method is using the above <code>.to()</code> method and inherits it's functionality. Considering a given collection <code>myDivs</code> elements, a nice example would be:</p>
<pre><code class="language-javascript">// on the fly, grab the elements by className,
// do the tween objects array, and start kicking
@ -139,6 +139,7 @@ tween.start(now); // where now must be the current or future time as number, see
// lastly the method works with tweens made with .allTo() and .allFromTo() methods
KUTE.allFromTo(divs,{opacity:1},{opacity:0}).start();
KUTE.allTo(divs,{opacity:0}).start();
</code></pre>
<p>As you can see, you can also set a time for the animation to start, example: <code>tween.start(myTimeValue)</code>. Having access to the method is useful when starting animation for large amounts of elements with same properties at the same time because using it properly <strong>eliminates any syncronization issue</strong> that may occur on animations start, even if you are using the <code>.to()</code> method. The trick is super duper simple:</p>

View file

@ -347,7 +347,7 @@ playPauseButton.addEventListener('click', function(e){
/* MULTI TWEENS EXAMPLE */
var tweenMulti = KUTE.allFromTo('.example-multi',
{translate:[0,0], rotate: 0},
{translate:[0,-50], rotate: 360},
{translate:[0,-150], rotate: 360},
{transformOrigin: '10% 10%', offset: 300, duration: 1000, easing: 'easingCubicOut', repeat: 1, repeatDelay: 1000, yoyo: true}
);
function startMultiTween() {

View file

@ -438,18 +438,17 @@ playPauseButton.addEventListener('click', function(e){
<li>make sure you work with the conditions properly when you want to pause an animation you MUST check both <code>!myTween.playing</code> and <code>myTween.paused</code> conditions because you could end up with errors.</li>
</ul>
<h2>Multi Tweens</h2>
<p>With KUTE.js 1.0.1 we introduced new tween object constructor methods, let's have a little fun.</p>
<h2>Tween Object Collections</h2>
<p>With KUTE.js 1.0.1 we introduced new tween object constructor methods, they allow you to create a tween object for each element in a collection, a very handy way to ease and speed up the animation programing workflow. Let's have a little fun.</p>
<pre><code class="language-javascript">// a simple .to() for a collection of elements would look like this
var myMultiTween1 = KUTE.allTo('selector1',{translate:[0,150]});
// or a more complex example with the two new options
// or a more complex .fromTo() example with the two new options
var myMultiTween2 = KUTE.allFromTo(
'selector1',
'selector2',
{translate:[0,0], rotate: 0},
{translate:[0,150], rotate: 360},
{transformOrigin: '100% 100%', offset: 200 }
{transformOrigin: '10% 10%', offset: 200 }
);
</code></pre>

View file

@ -1,2 +1,2 @@
// bezier easing for KUTE.js | dnp_theme | MIT License
KUTE.Ease={},KUTE.Ease.bezier=function(n,e,t,r){return _bz.pB(n,e,t,r)};var _bz=KUTE.Ease.bezier.prototype;_bz.ni=4,_bz.nms=.001,_bz.sp=1e-7,_bz.smi=10,_bz.ksts=11,_bz.ksss=1/(_bz.ksts-1),_bz.f32as="Float32Array"in window,_bz.msv=_bz.f32as?new Float32Array(_bz.ksts):new Array(_bz.ksts),_bz.A=function(n,e){return 1-3*e+3*n},_bz.B=function(n,e){return 3*e-6*n},_bz.C=function(n){return 3*n},_bz.r={},_bz.pB=function(n,e,t,r){this._p=!1;var u=this;return _bz.r=function(s){return u._p||_bz.pc(n,t,e,r),n===e&&t===r?s:0===s?0:1===s?1:_bz.cB(_bz.gx(s,n,t),e,r)},_bz.r},_bz.cB=function(n,e,t){return((_bz.A(e,t)*n+_bz.B(e,t))*n+_bz.C(e))*n},_bz.gS=function(n,e,t){return 3*_bz.A(e,t)*n*n+2*_bz.B(e,t)*n+_bz.C(e)},_bz.bS=function(n,e,t,r,u){var s,b,_=0,z=_bz.sp,a=_bz.smi;do b=e+(t-e)/2,s=_bz.cB(b,r,u)-n,s>0?t=b:e=b;while(Math.abs(s)>z&&++_<a);return b},_bz.nri=function(n,e,t,r){var u=0,s=_bz.ni;for(u;s>u;++u){var b=_bz.gS(e,t,r);if(0===b)return e;var _=_bz.cB(e,t,r)-n;e-=_/b}return e},_bz.csv=function(n,e){var t=0,r=_bz.ksts;for(t;r>t;++t)_bz.msv[t]=_bz.cB(t*_bz.ksss,n,e)},_bz.gx=function(n,e,t){for(var r=0,u=1,s=_bz.ksts-1;u!=s&&_bz.msv[u]<=n;++u)r+=_bz.ksss;--u;var b=(n-_bz.msv[u])/(_bz.msv[u+1]-_bz.msv[u]),_=r+b*_bz.ksss,z=_bz.gS(_,e,t),a=r+_bz.ksss;return z>=_bz.nms?_bz.nri(n,_,e,t):0===z?_:_bz.bS(n,r,a,e,t)},_bz.pc=function(n,e,t,r){this._p=!0,(n!=t||e!=r)&&_bz.csv(n,e)},KUTE.Ease.easeIn=function(){return _bz.pB(.42,0,1,1)},KUTE.Ease.easeOut=function(){return _bz.pB(0,0,.58,1)},KUTE.Ease.easeInOut=function(){return _bz.pB(.5,.16,.49,.86)},KUTE.Ease.easeInSine=function(){return _bz.pB(.47,0,.745,.715)},KUTE.Ease.easeOutSine=function(){return _bz.pB(.39,.575,.565,1)},KUTE.Ease.easeInOutSine=function(){return _bz.pB(.445,.05,.55,.95)},KUTE.Ease.easeInQuad=function(){return _bz.pB(.55,.085,.68,.53)},KUTE.Ease.easeOutQuad=function(){return _bz.pB(.25,.46,.45,.94)},KUTE.Ease.easeInOutQuad=function(){return _bz.pB(.455,.03,.515,.955)},KUTE.Ease.easeInCubic=function(){return _bz.pB(.55,.055,.675,.19)},KUTE.Ease.easeOutCubic=function(){return _bz.pB(.215,.61,.355,1)},KUTE.Ease.easeInOutCubic=function(){return _bz.pB(.645,.045,.355,1)},KUTE.Ease.easeInQuart=function(){return _bz.pB(.895,.03,.685,.22)},KUTE.Ease.easeOutQuart=function(){return _bz.pB(.165,.84,.44,1)},KUTE.Ease.easeInOutQuart=function(){return _bz.pB(.77,0,.175,1)},KUTE.Ease.easeInQuint=function(){return _bz.pB(.755,.05,.855,.06)},KUTE.Ease.easeOutQuint=function(){return _bz.pB(.23,1,.32,1)},KUTE.Ease.easeInOutQuint=function(){return _bz.pB(.86,0,.07,1)},KUTE.Ease.easeInExpo=function(){return _bz.pB(.95,.05,.795,.035)},KUTE.Ease.easeOutExpo=function(){return _bz.pB(.19,1,.22,1)},KUTE.Ease.easeInOutExpo=function(){return _bz.pB(1,0,0,1)},KUTE.Ease.easeInCirc=function(){return _bz.pB(.6,.04,.98,.335)},KUTE.Ease.easeOutCirc=function(){return _bz.pB(.075,.82,.165,1)},KUTE.Ease.easeInOutCirc=function(){return _bz.pB(.785,.135,.15,.86)},KUTE.Ease.easeInBack=function(){return _bz.pB(.6,-.28,.735,.045)},KUTE.Ease.easeOutBack=function(){return _bz.pB(.175,.885,.32,1.275)},KUTE.Ease.easeInOutBack=function(){return _bz.pB(.68,-.55,.265,1.55)},KUTE.Ease.slowMo=function(){return _bz.pB(0,.5,1,.5)},KUTE.Ease.slowMo1=function(){return _bz.pB(0,.7,1,.3)},KUTE.Ease.slowMo2=function(){return _bz.pB(0,.9,1,.1)};
!function(n){if("function"==typeof define&&define.amd)define(["./kute.js"],function(e){return n(e),e});else if("object"==typeof module&&"function"==typeof require){var e=require("./kute.js");module.exports=n(e)}else{if("undefined"==typeof window.KUTE)throw new Error("Bezier Easing functions depend on KUTE.js. Read the docs for more info.");window.KUTE.Ease=window.KUTE.Ease||n(e)}}(function(n){"use strict";var e=e||{};e.Bezier=function(n,e,r,u){return t.pB(n,e,r,u)};var t=e.Bezier.prototype;return t.ni=4,t.nms=.001,t.sp=1e-7,t.smi=10,t.ksts=11,t.ksss=1/(t.ksts-1),t.f32as="Float32Array"in window,t.msv=t.f32as?new Float32Array(t.ksts):new Array(t.ksts),t.A=function(n,e){return 1-3*e+3*n},t.B=function(n,e){return 3*e-6*n},t.C=function(n){return 3*n},t.r={},t.pB=function(n,e,r,u){this._p=!1;var i=this;return t.r=function(s){return i._p||t.pc(n,r,e,u),n===e&&r===u?s:0===s?0:1===s?1:t.cB(t.gx(s,n,r),e,u)},t.r},t.cB=function(n,e,r){return((t.A(e,r)*n+t.B(e,r))*n+t.C(e))*n},t.gS=function(n,e,r){return 3*t.A(e,r)*n*n+2*t.B(e,r)*n+t.C(e)},t.bS=function(n,e,r,u,i){var s,o,c=0,f=t.sp,a=t.smi;do o=e+(r-e)/2,s=t.cB(o,u,i)-n,s>0?r=o:e=o;while(Math.abs(s)>f&&++c<a);return o},t.nri=function(n,e,r,u){var i=0,s=t.ni;for(i;s>i;++i){var o=t.gS(e,r,u);if(0===o)return e;var c=t.cB(e,r,u)-n;e-=c/o}return e},t.csv=function(n,e){var r=0,u=t.ksts;for(r;u>r;++r)t.msv[r]=t.cB(r*t.ksss,n,e)},t.gx=function(n,e,r){for(var u=0,i=1,s=t.ksts-1;i!=s&&t.msv[i]<=n;++i)u+=t.ksss;--i;var o=(n-t.msv[i])/(t.msv[i+1]-t.msv[i]),c=u+o*t.ksss,f=t.gS(c,e,r),a=u+t.ksss;return f>=t.nms?t.nri(n,c,e,r):0===f?c:t.bS(n,u,a,e,r)},t.pc=function(n,e,r,u){this._p=!0,(n!=r||e!=u)&&t.csv(n,e)},e.easeIn=function(){return t.pB(.42,0,1,1)},e.easeOut=function(){return t.pB(0,0,.58,1)},e.easeInOut=function(){return t.pB(.5,.16,.49,.86)},e.easeInSine=function(){return t.pB(.47,0,.745,.715)},e.easeOutSine=function(){return t.pB(.39,.575,.565,1)},e.easeInOutSine=function(){return t.pB(.445,.05,.55,.95)},e.easeInQuad=function(){return t.pB(.55,.085,.68,.53)},e.easeOutQuad=function(){return t.pB(.25,.46,.45,.94)},e.easeInOutQuad=function(){return t.pB(.455,.03,.515,.955)},e.easeInCubic=function(){return t.pB(.55,.055,.675,.19)},e.easeOutCubic=function(){return t.pB(.215,.61,.355,1)},e.easeInOutCubic=function(){return t.pB(.645,.045,.355,1)},e.easeInQuart=function(){return t.pB(.895,.03,.685,.22)},e.easeOutQuart=function(){return t.pB(.165,.84,.44,1)},e.easeInOutQuart=function(){return t.pB(.77,0,.175,1)},e.easeInQuint=function(){return t.pB(.755,.05,.855,.06)},e.easeOutQuint=function(){return t.pB(.23,1,.32,1)},e.easeInOutQuint=function(){return t.pB(.86,0,.07,1)},e.easeInExpo=function(){return t.pB(.95,.05,.795,.035)},e.easeOutExpo=function(){return t.pB(.19,1,.22,1)},e.easeInOutExpo=function(){return t.pB(1,0,0,1)},e.easeInCirc=function(){return t.pB(.6,.04,.98,.335)},e.easeOutCirc=function(){return t.pB(.075,.82,.165,1)},e.easeInOutCirc=function(){return t.pB(.785,.135,.15,.86)},e.easeInBack=function(){return t.pB(.6,-.28,.735,.045)},e.easeOutBack=function(){return t.pB(.175,.885,.32,1.275)},e.easeInOutBack=function(){return t.pB(.68,-.55,.265,1.55)},e.slowMo=function(){return t.pB(0,.5,1,.5)},e.slowMo1=function(){return t.pB(0,.7,1,.3)},e.slowMo2=function(){return t.pB(0,.9,1,.1)},e});

View file

@ -1,2 +1,2 @@
// KUTE jQuery Plugin for KUTE.js | by dnp_theme | License - MIT
!function(t){t.fn.KUTE=function(t,n,i,h){var s,o=[],a=this.length;for(s=0;a>s;s++){var e=this[s][t];"function"==typeof e&&e.apply(this[s]),"to"===t?o.push(new KUTE[t](this[s],n,i)):"fromTo"===t||"Animate"===t?o.push(new KUTE[t](this[s],n,i,h)):"chain"===t&&this[s].chain.apply(this[s],n)}return o}}(jQuery);
!function(e){if("function"==typeof define&&define.amd)define(["./kute.js","jQuery"],function(n,i){return e(i,n),n});else if("object"==typeof module&&"function"==typeof require){var n=require("./kute.js"),i=require("jQuery");module.exports=e(i,n)}else{if("undefined"==typeof window.KUTE||"undefined"==typeof window.$&&"undefined"==typeof window.jQuery)throw new Error("jQuery plugin for KUTE.js depends on KUTE.js and jQuery. Read the docs for more info.");var i=window.jQuery||window.$,n=window.KUTE;i.fn.KUTE=e(i,n)}}(function(e,n){"use strict";var i=function(e,i,o,t){var r,u=[],f=this.length;for(r=0;f>r;r++){var d=this[r][e];"function"==typeof d&&d.apply(this[r]),"to"===e?u.push(new n[e](this[r],i,o)):"fromTo"===e||"Animate"===e?u.push(new n[e](this[r],i,o,t)):"chain"===e&&this[r].chain.apply(this[r],i)}return u};return i});

View file

@ -1,2 +1,2 @@
// dynamics easings KUTE.js | dnp_theme | MIT License
KUTE.Physics={};var _kp=KUTE.Physics,_hPI=Math.PI/2;_kp.spring=function(n){n=n||{};var r=Math.max(1,(n.frequency||300)/20),t=Math.pow(20,(n.friction||200)/100),p=n.anticipationStrength||0,i=(n.anticipationSize||0)/1e3;return _kps.run=function(n){var o,e,a,u,c,k,_,y;return k=n/(1-i)-i/(1-i),i>n?(y=i/(1-i)-i/(1-i),_=0/(1-i)-i/(1-i),c=Math.acos(1/_kps.A1(n,y)),a=(Math.acos(1/_kps.A1(n,_))-c)/(r*-i),o=_kps.A1):(o=_kps.A2,c=0,a=1),e=o(k,i,p,t),u=r*(n-i)*a+c,1-e*Math.cos(u)},_kps.run};var _kps=_kp.spring.prototype;_kps.run={},_kps.A1=function(n,r,t){var p,i,o,e;return o=r/(1-r),e=0,i=(o-.8*e)/(o-e),p=(.8-i)/o,p*n*t/100+i},_kps.A2=function(n,r,t,p){return Math.pow(p/10,-n)*(1-n)},_kp.bounce=function(n){n=n||{};var r=Math.max(1,(n.frequency||300)/20),t=Math.pow(20,(n.friction||200)/100);return _kpo.run=function(n){var p=Math.pow(t/10,-n)*(1-n),i=r*n*1+_hPI;return p*Math.cos(i)},_kpo.run};var _kpo=_kp.bounce.prototype;_kpo.run={},_kp.gravity=function(n){var r,t,p,i,o;return n=n||{},r=(n.bounciness||400)/1250,p=(n.elasticity||200)/1e3,o=n.initialForce||!1,i=100,t=[],_kpg.L=function(){var n,t;for(n=Math.sqrt(2/i),t={a:-n,b:n,H:1},o&&(t.a=0,t.b=2*t.b);t.H>.001;)_kpg.L=t.b-t.a,t={a:t.b,b:t.b+_kpg.L*r,H:t.H*r*r};return t.b}(),function(){var n,e,a,u;for(e=Math.sqrt(2/(i*_kpg.L*_kpg.L)),a={a:-e,b:e,H:1},o&&(a.a=0,a.b=2*a.b),t.push(a),n=_kpg.L,u=[];a.b<1&&a.H>.001;)n=a.b-a.a,a={a:a.b,b:a.b+n*r,H:a.H*p},u.push(t.push(a));return u}(),_kpg.fn=function(r){var p,i,e;for(i=0,p=t[i];!(r>=p.a&&r<=p.b)&&(i+=1,p=t[i]););return e=p?_kpg.getPointInCurve(p.a,p.b,p.H,r,n,_kpg.L):o?0:1},_kpg.fn};var _kpg=_kp.gravity.prototype;_kpg.L={},_kpg.fn={},_kpg.getPointInCurve=function(n,r,t,p,i,o){var e,a;return o=r-n,a=2/o*p-1-2*n/o,e=a*a*t-t+1,i.initialForce&&(e=1-e),e},_kp.forceWithGravity=function(n){var r=n||{};return r.initialForce=!0,_kp.gravity(r)},_kp.bezier=function(n){n=n||{};var r=n.points,t=!1,p=[];return function(){var n,t;for(n in r){if(t=parseInt(n),t>=r.length-1)break;_kpb.fn(r[t],r[t+1],p)}return p}(),_kpb.run=function(n){return 0===n?0:1===n?1:_kpb.yForX(n,p,t)},_kpb.run};var _kpb=_kp.bezier.prototype;_kpb.B2={},_kpb.run={},_kpb.fn=function(n,r,t){var p=function(t){return _kpb.Bezier(t,n,n.cp[n.cp.length-1],r.cp[0],r)};return t.push(p)},_kpb.Bezier=function(n,r,t,p,i){return{x:Math.pow(1-n,3)*r.x+3*Math.pow(1-n,2)*n*t.x+3*(1-n)*Math.pow(n,2)*p.x+Math.pow(n,3)*i.x,y:Math.pow(1-n,3)*r.y+3*Math.pow(1-n,2)*n*t.y+3*(1-n)*Math.pow(n,2)*p.y+Math.pow(n,3)*i.y}},_kpb.yForX=function(n,r,t){var p,i,o,e,a,u,c,k,_=0,y=r.length;for(p=null,_;y>_&&(i=r[_],n>=i(0).x&&n<=i(1).x&&(p=i),null===p);_++);if(!p)return t?0:1;for(k=1e-4,e=0,u=1,a=(u+e)/2,c=p(a).x,o=0;Math.abs(n-c)>k&&100>o;)n>c?e=a:u=a,a=(u+e)/2,c=p(a).x,o++;return p(a).y},_kp.physicsInOut=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},_kp.physicsIn=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},_kp.physicsOut=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},_kp.physicsBackOut=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.735+r/1e3,y:1.3}]}]})},_kp.physicsBackIn=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:.28-r/1e3,y:-.6}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},_kp.physicsBackInOut=function(n){var r;return n=n||{},r=n.friction||500,_kp.bezier({points:[{x:0,y:0,cp:[{x:.68-r/1e3,y:-.55}]},{x:1,y:1,cp:[{x:.265+r/1e3,y:1.45}]}]})};
!function(n){if("function"==typeof define&&define.amd)define(["./kute.js"],function(r){return n(r),r});else if("object"==typeof module&&"function"==typeof require){var r=require("./kute.js");module.exports=n(r)}else{if("undefined"==typeof window.KUTE)throw new Error("Physics Easing functions for KUTE.js depend on KUTE.js. Read the docs for more info.");window.KUTE.Physics=window.KUTE.Physics||n(r)}}(function(n){"use strict";var r=r||{},t=Math.PI/2;r.spring=function(n){n=n||{};var r=Math.max(1,(n.frequency||300)/20),t=Math.pow(20,(n.friction||200)/100),i=n.anticipationStrength||0,o=(n.anticipationSize||0)/1e3;return e.run=function(n){var u,c,a,f,p,y,s,h;return y=n/(1-o)-o/(1-o),o>n?(h=o/(1-o)-o/(1-o),s=0/(1-o)-o/(1-o),p=Math.acos(1/e.A1(n,h)),a=(Math.acos(1/e.A1(n,s))-p)/(r*-o),u=e.A1):(u=e.A2,p=0,a=1),c=u(y,o,i,t),f=r*(n-o)*a+p,1-c*Math.cos(f)},e.run};var e=r.spring.prototype;e.run={},e.A1=function(n,r,t){var e,i,o,u;return o=r/(1-r),u=0,i=(o-.8*u)/(o-u),e=(.8-i)/o,e*n*t/100+i},e.A2=function(n,r,t,e){return Math.pow(e/10,-n)*(1-n)},r.bounce=function(n){n=n||{};var r=Math.max(1,(n.frequency||300)/20),e=Math.pow(20,(n.friction||200)/100);return i.run=function(n){var i=Math.pow(e/10,-n)*(1-n),o=r*n*1+t;return i*Math.cos(o)},i.run};var i=r.bounce.prototype;i.run={},r.gravity=function(n){var r,t,e,i,u;return n=n||{},r=(n.bounciness||400)/1250,e=(n.elasticity||200)/1e3,u=n.initialForce||!1,i=100,t=[],o.L=function(){var n,t;for(n=Math.sqrt(2/i),t={a:-n,b:n,H:1},u&&(t.a=0,t.b=2*t.b);t.H>.001;)o.L=t.b-t.a,t={a:t.b,b:t.b+o.L*r,H:t.H*r*r};return t.b}(),function(){var n,c,a,f;for(c=Math.sqrt(2/(i*o.L*o.L)),a={a:-c,b:c,H:1},u&&(a.a=0,a.b=2*a.b),t.push(a),n=o.L,f=[];a.b<1&&a.H>.001;)n=a.b-a.a,a={a:a.b,b:a.b+n*r,H:a.H*e},f.push(t.push(a));return f}(),o.fn=function(r){var e,i,c;for(i=0,e=t[i];!(r>=e.a&&r<=e.b)&&(i+=1,e=t[i]););return c=e?o.getPointInCurve(e.a,e.b,e.H,r,n,o.L):u?0:1},o.fn};var o=r.gravity.prototype;o.L={},o.fn={},o.getPointInCurve=function(n,r,t,e,i,o){var u,c;return o=r-n,c=2/o*e-1-2*n/o,u=c*c*t-t+1,i.initialForce&&(u=1-u),u},r.forceWithGravity=function(n){var t=n||{};return t.initialForce=!0,r.gravity(t)},r.bezier=function(n){n=n||{};var r=n.points,t=!1,e=[];return function(){var n,t;for(n in r){if(t=parseInt(n),t>=r.length-1)break;u.fn(r[t],r[t+1],e)}return e}(),u.run=function(n){return 0===n?0:1===n?1:u.yForX(n,e,t)},u.run};var u=r.bezier.prototype;return u.B2={},u.run={},u.fn=function(n,r,t){var e=function(t){return u.Bezier(t,n,n.cp[n.cp.length-1],r.cp[0],r)};return t.push(e)},u.Bezier=function(n,r,t,e,i){return{x:Math.pow(1-n,3)*r.x+3*Math.pow(1-n,2)*n*t.x+3*(1-n)*Math.pow(n,2)*e.x+Math.pow(n,3)*i.x,y:Math.pow(1-n,3)*r.y+3*Math.pow(1-n,2)*n*t.y+3*(1-n)*Math.pow(n,2)*e.y+Math.pow(n,3)*i.y}},u.yForX=function(n,r,t){var e,i,o,u,c,a,f,p,y=0,s=r.length;for(e=null,y;s>y&&(i=r[y],n>=i(0).x&&n<=i(1).x&&(e=i),null===e);y++);if(!e)return t?0:1;for(p=1e-4,u=0,a=1,c=(a+u)/2,f=e(c).x,o=0;Math.abs(n-f)>p&&100>o;)n>f?u=c:a=c,c=(a+u)/2,f=e(c).x,o++;return e(c).y},r.physicsInOut=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:.92-t/1e3,y:0}]},{x:1,y:1,cp:[{x:.08+t/1e3,y:1}]}]})},r.physicsIn=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:.92-t/1e3,y:0}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},r.physicsOut=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.08+t/1e3,y:1}]}]})},r.physicsBackOut=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.735+t/1e3,y:1.3}]}]})},r.physicsBackIn=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:.28-t/1e3,y:-.6}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},r.physicsBackInOut=function(n){var t;return n=n||{},t=n.friction||500,r.bezier({points:[{x:0,y:0,cp:[{x:.68-t/1e3,y:-.55}]},{x:1,y:1,cp:[{x:.265+t/1e3,y:1.45}]}]})},r});

2
dist/kute.min.js vendored

File diff suppressed because one or more lines are too long