kute.js/dist/kute.min.js

3 lines
41 KiB
JavaScript
Raw Normal View History

2021-12-29 17:42:20 +01:00
// KUTE.js Standard v2.2.3 | thednp © 2021 | MIT-License
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=e()}(this,(function(){"use strict";var t=function(t,e,n,r,a){var i=this;this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by;var o=function(t){return i.sampleCurveY(i.solveCurveX(t))};return Object.defineProperty(o,"name",{writable:!0}),o.name=a||"cubic-bezier("+[t,e,n,r]+")",o};t.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},t.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},t.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},t.prototype.solveCurveX=function(t){var e,n,r,a,i,o,s=1e-5;for(r=t,o=0;o<32;o+=1){if(a=this.sampleCurveX(r)-t,Math.abs(a)<s)return r;if(i=this.sampleCurveDerivativeX(r),Math.abs(i)<s)break;r-=a/i}if((r=t)<(e=0))return e;if(r>(n=1))return n;for(;e<n;){if(a=this.sampleCurveX(r),Math.abs(a-t)<s)return r;t>a?e=r:n=r,r=.5*(n-e)+e}return r};Object.assign(t,{Version:"1.0.18"});var e={},n=[],r="undefined"!=typeof global?global:"undefined"!=typeof window?window.self:{},a={},i={},o="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):"undefined"!=typeof Date&&Date.now?Date.now:function(){return(new Date).getTime()},s={};s.now=o;var u=0,c=function(t){for(var e=0;e<n.length;)n[e].update(t)?e+=1:n.splice(e,1);u=requestAnimationFrame(c)};function l(){setTimeout((function(){!n.length&&u&&(cancelAnimationFrame(u),u=null,Object.keys(i).forEach((function(t){"function"==typeof i[t]?e[t]&&delete e[t]:Object.keys(i[t]).forEach((function(t){e[t]&&delete e[t]}))})),Object.keys(a).forEach((function(t){e[t]&&delete e[t]})))}),64)}var p={Tick:u,Ticker:c,Tweens:n,Time:s};Object.keys(p).forEach((function(t){e[t]||(e[t]="Time"===t?s.now:p[t])})),r._KUTE=e;var f={},h={},d={duration:700,delay:0,easing:"linear",repeat:0,repeatDelay:0,yoyo:!1,resetStart:!1,offset:0},y={},v={},g={},m={},b={},x={supportedProperties:f,defaultValues:h,defaultOptions:d,prepareProperty:y,prepareStart:v,crossCheck:g,onStart:i,onComplete:m,linkProperty:b},w={},E=function(t){return n.push(t)},M=function(t){var e=n.indexOf(t);-1!==e&&n.splice(e,1)};function _(){var t=this;Object.keys(b).forEach((function(n){var r=b[n],a=f[n];Object.keys(r).forEach((function(n){"function"==typeof r[n]&&Object.keys(t.valuesEnd).some((function(e){return a&&a.includes(e)||"attr"===e&&Object.keys(t.valuesEnd[e]).some((function(t){return a&&a.includes(t)}))}))?e[n]||(e[n]=r[n]):Object.keys(t.valuesEnd).forEach((function(a){var i=t.valuesEnd[a];i instanceof Object&&Object.keys(i).forEach((function(t){"function"==typeof r[t]?e[t]||(e[t]=r[t]):Object.keys(r[n]).forEach((function(n){r[t]&&"function"==typeof r[t][n]&&(e[n]||(e[n]=r[t][n]))}))}))}))}))}))}var k={add:E,remove:M,getAll:function(){return n},removeAll:function(){n.length=0},stop:l,linkInterpolation:_};function C(t){if(!t.style)return!1;var e=t.style.cssText.replace(/\s/g,"").split(";"),n={},r=["translate3d","translate","scale3d","skew"];return e.forEach((function(t){/transform/i.test(t)&&t.split(":")[1].split(")").forEach((function(t){var e=t.split("("),a=e[0],i=e[1];/matrix/.test(a)||(n[a]=r.includes(a)?i.split(","):i)}))})),n}function O(t,e){var n=h[e],r=t.style,a=getComputedStyle(t)||t.currentStyle,i=r[e]&&!/auto|initial|none|unset/.test(r[e])?r[e]:a[e];return"transform"!==e&&(e in a||e in r)&&(n=i),n}function T(t,e){var n=this,r="start"===e?this.valuesStart:this.valuesEnd;Object.keys(y).forEach((function(e){var a=y[e],i=f[e];Object.keys(a).forEach((function(e){var o={};Object.keys(t).forEach((function(s){h[s]&&a[s]?r[s]=a[s].call(n,s,t[s]):!h[e]&&"transform"===e&&i.includes(s)?o[s]=t[s]:h[s]||"transform"!==s?!h[e]&&i&&i.includes(s)&&(r[s]=a[e].call(n,s,t[s])):r[s]=t[