-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathjquery.keyframes.min.js
More file actions
1 lines (1 loc) · 14.6 KB
/
jquery.keyframes.min.js
File metadata and controls
1 lines (1 loc) · 14.6 KB
1
!function r(o,i,a){function s(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},o[t][0].call(n.exports,function(e){return s(o[t][1][e]||e)},n,n.exports,r,o,i,a)}return i[t].exports}for(var u="function"==typeof require&&require,e=0;e<a.length;e++)s(a[e]);return s}({1:[function(e,t,n){var r=(e=e("@keyframes/core"))&&e.__esModule?e:{default:e};function o(e,n){e.each(function(e,t){t.Keyframes||(t.Keyframes=new r.default(t)),n(t.Keyframes)})}(e=jQuery).keyframe={isSupported:r.default.isSupported,generate:r.default.generate,generateCSS:r.default.generateCSS,define:function(e){return r.default.define(e)}},e.fn.resetKeyframe=function(t){o(this,function(e){e.reset().then(t)})},e.fn.pauseKeyframe=function(){o(this,function(e){e.pause()})},e.fn.resumeKeyframe=function(){o(this,function(e){e.resume()})},e.fn.playKeyframe=function(t,e){var n=e;"function"==typeof(e=t.complete?t.complete:e)&&(n={onIteration:e,onEnd:e}),o(this,function(e){e.play(t,n)})}},{"@keyframes/core":2}],2:[function(e,t,n){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(){return new Promise(function(e){requestAnimationFrame(function(){e()})})}function o(){}var a,s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},u=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&("get"in o?t.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){e[r=void 0===r?n:r]=t[n]},c=function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||u(t,e,n)},l=function(e,a,s,u){return new(s=s||Promise)(function(n,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function o(e){try{i(u.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,o)}i((u=u.apply(e,a||[])).next())})},f=function(r,o){var i,a,s,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=e(0),c.throw=e(1),c.return=e(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function e(n){return function(e){var t=[n,e];if(i)throw new TypeError("Generator is already executing.");for(;u=c&&t[c=0]?0:u;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,a=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))u.label=t[1];else if(6===t[0]&&u.label<s[1])u.label=s[1],s=t;else{if(!(s&&u.label<s[2])){s[2]&&u.ops.pop(),u.trys.pop();continue}u.label=s[2],u.ops.push(t)}}t=o.call(r,u)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},h=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},p=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},y=function(e){return e&&e.__esModule?e:{default:e}},m=(Object.defineProperty(n,"__esModule",{value:!0}),n.isBrowser=void 0,y(e("add-px-to-style"))),d=y(e("hyphenate-style-name")),v=(n.isBrowser="undefined"!=typeof window,n.isBrowser&&((y=document.createElement("style")).setAttribute("id","keyframesjs-stylesheet"),document.head.appendChild(y),a=y.sheet),{onStart:o,onBeforeStart:o,onIteration:o,onEnd:o,onQueueComplete:o,onCancel:o}),y=(g.isSupported=function(){return void 0!==document.body.style.animationName},g.prototype.freeze=function(){var t,n=this,e=g.ruleCache[this.mountedElement.style.animationName];e&&(t=s({},getComputedStyle(this.mountedElement)),e.forEach(function(e){n.mountedElement.style[e]=t[e]}),this.frozenStyles=p([],h(new Set(this.frozenStyles.concat(e))),!1))},g.prototype.unfreeze=function(){var t=this;this.frozenStyles.length&&(this.frozenStyles.forEach(function(e){t.mountedElement.style[e]=""}),this.frozenStyles=[])},g.prototype.reset=function(){return l(this,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return this.log("reset"),this.playing=!1,this.removeEvents(),this.mountedElement.style.animationPlayState="running",this.mountedElement.style.animation="none",[4,r()];case 1:return e.sent(),[2,this]}})})},g.prototype.pause=function(){return this.mountedElement.style.animationPlayState="paused",this},g.prototype.resume=function(){return this.mountedElement.style.animationPlayState="running",this},g.prototype.play=function(t,n){var r,o=this;this.log("play",t);var e=void 0===(e=(c=n||{}).onBeforeStart)?null:e,i=c.onStart,a=void 0===i?null:i,s=void 0===(i=c.onIteration)?null:i,u=void 0===(i=c.onEnd)?null:i,c=void 0===(i=c.onCancel)?null:i;return!0===this.playing&&(this.log("cancelled"),this.previousCancel)&&(this.queueStore=[],this.previousCancel()),c&&(this.previousCancel=c),this.mountedElement.style.animationName===this.getAnimationName(t)?(this.freeze(),requestAnimationFrame(function(){return l(o,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return[4,this.reset()];case 1:return e.sent(),this.play(t,n),this.unfreeze(),[2]}})})})):(this.playing=!0,r=Array.isArray(t)?t.length:1,i=g.playCSS(t),c=function(e,t){var n="".concat(e,"Listener");o.mountedElement.removeEventListener(e,o[n]),o[n]=t,o.mountedElement.addEventListener(e,o[n])},this.log("onBeforeStart"),e&&e(),this.mountedElement.style.animationPlayState="running",this.mountedElement.style.animation=i,c("animationiteration",function(e){o.log("animationiteration",e),s&&s(e)}),c("animationend",function(e){--r||(o.log("ended",e),o.playing=!1,u&&!r&&u(e))}),c("animationstart",function(e){o.log("onStart",e),a&&a(e)})),this},g.prototype.playNext=function(){var t=this,e=this.queueStore[this.queueStore.length-1];e?this.log("playNext",e):this.log("Queue Complete"),e?this.play(e,{onEnd:function(e){t.queueStore.pop(),t.callbacks.onEnd&&t.callbacks.onEnd(e),t.playNext()},onCancel:this.callbacks.onCancel,onIteration:this.callbacks.onIteration}):this.callbacks.onQueueComplete&&this.callbacks.onQueueComplete()},g.prototype.removeEvents=function(){return this.log("events cleared"),this.mountedElement.removeEventListener("animationiteration",this.animationiterationListener),this.mountedElement.removeEventListener("animationend",this.animationendListener),this.mountedElement.removeEventListener("animationstart",this.animationstartListener),this},g.prototype.updateCallbacks=function(e){e&&(this.callbacks=s(s({},this.callbacks),e))},g.prototype.queue=function(e,t){var n,r=this,o=this.queueStore.length,t=(this.updateCallbacks(s(s({},v),t)),n=e,Array.isArray(n)?p([],h(n),!1):"object"==i(n)?s({},n):n.toString());return Array.isArray(t)?this.queueStore=t.reverse().concat(this.queueStore):this.queueStore.unshift(t),this.log("queued",e,o),o?this.playing||this.playNext():requestAnimationFrame(function(){return l(r,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return[4,this.reset()];case 1:return e.sent(),this.playNext(),[2]}})})}),this},g.prototype.chain=function(e,t){return this.queue(e,t),this},g.prototype.resetQueue=function(){return l(this,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return this.log("resetQueue"),[4,r()];case 1:return e.sent(),this.removeEvents(),this.queueStore=[],[4,this.reset()];case 2:return e.sent(),[2,this]}})})},g.prototype.loop=function(e){return l(this,arguments,void 0,function(t,n){var r,o=this;return void 0===n&&(n={}),f(this,function(e){switch(e.label){case 0:return this.log("loop",t),[4,this.resetQueue()];case 1:return e.sent(),(r=function(){o.queue(t,s(s({},n),{onQueueComplete:function(){return r()}}))})(),[2,this]}})})},g.prototype.getAnimationName=function(e){var t=this;return Array.isArray(e)?e.map(function(e){return t.getAnimationName(e)}).join(", "):"string"==typeof e?e.split(" ")[0]:e.name},g.playCSS=function(e){function t(e){return[(e=s({duration:"0s",timingFunction:"ease",delay:"0s",iterationCount:1,direction:"normal",fillMode:"forwards"},e)).name,e.duration,e.timingFunction,e.delay,e.iterationCount,e.direction,e.fillMode].join(" ")}if(Array.isArray(e)){for(var n=[],r=0;r<e.length;r+=1){var o=e[r];n.push("string"==typeof o?o:t(o))}return n.join(", ")}return"string"==typeof e?e:t(e)},g.generateCSS=function(e){var t,n,r="@keyframes ".concat(e.name," {");for(t in e)"name"!==t&&"media"!==t&&"complete"!==t&&(n=(e=>{if(!Object.keys(e).length)return"";var t,n="";for(t in e)n+="".concat((0,d.default)(t),":").concat((0,m.default)(t,e[t]),";");return n})(e[t]),r+="".concat(t," {").concat(n,"}"));return r+="}",e.media?"@media ".concat(e.media,"{").concat(r,"}"):r},g.generate=function(e){this.addToRuleCache(e);var t=this.generateCSS(e),n=(-1<(n=g.rules.indexOf(e.name))&&(g.sheet.deleteRule(n),g.rules.splice(n,1)),(g.sheet.cssRules||g.sheet.rules).length);g.sheet.insertRule(t,n),g.rules[n]=e.name},g.define=function(e){if(Array.isArray(e))for(var t=0;t<e.length;t+=1)this.generate(e[t]);else this.generate(e)},g.defineCSS=function(e){if(Array.isArray(e)){for(var t="",n=0;n<e.length;n+=1)t+=this.generateCSS(e[n]);return t}return this.generateCSS(e)},g.addToRuleCache=function(e){var t;this.ruleCache[e.name]||(t=Object.values(e).filter(function(e){return"object"==i(e)}).map(function(e){return Object.keys(e)}).flat(),this.ruleCache[e.name]=p([],h(new Set(t)),!1))},g.prototype.log=function(e){for(var t=1;t<arguments.length;t++);this.debug},g.sheet=a,g.rules=[],g.ruleCache={},g.clearRules=function(){for(g.rules=[];g.sheet.cssRules.length;)g.sheet.deleteRule(0)},g);function g(e,t){void 0===t&&(t=!1),this.playing=!1,this.previousCancel=o,this.debug=!1,this.queueStore=[],this.callbacks=v,this.animationstartListener=o,this.animationendListener=o,this.animationiterationListener=o,this.animationcancelListener=o,this.mountedElement=e,this.frozenStyles=[],this.debug=t}n.isBrowser&&(window.Keyframes=y),c(e("./pathfinder"),n),c(e("./spritesheet"),n),n.default=y},{"./pathfinder":3,"./spritesheet":4,"add-px-to-style":5,"hyphenate-style-name":6}],3:[function(e,t,n){var b=function(){return(b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},e=(Object.defineProperty(n,"__esModule",{value:!0}),n.circlePath=n.bezierPath=void 0,e("./keyframes"));var S=function(e,t){return{x:e=void 0===e?0:e,y:t=void 0===t?0:t}},w=function(e){return e*e*e},x=function(e){return 3*e*e*(1-e)},O=function(e){return 3*e*(1-e)*(1-e)},C=function(e){return(1-e)*(1-e)*(1-e)};n.bezierPath=function(e,t,n,r,o){for(var i,a,s,u,c,l=b({bezierSteps:100,transform:""},e),f=(null==o&&(o=t),S(t[0],t[1])),h=S(n[0],n[1]),p=S(r[0],r[1]),y=S(o[0],o[1]),m={},d=1/l.bezierSteps,v=0;v<=1.01;v+=d){i=v,g=f,a=y,s=p,u=h,c=void 0,(c=S()).x=g.x*w(i)+a.x*x(i)+s.x*O(i)+u.x*C(i),c.y=g.y*w(i)+a.y*x(i)+s.y*O(i)+u.y*C(i);var g=c;m["".concat(100-Math.round(100*v),"%")]={transform:"translate(".concat(g.x,"px,").concat(g.y,"px) ").concat(l.transform)}}return Object.assign({},e,m)};n.circlePath=function(e,t,n){for(var r,o,i,a=b({circleSteps:100,transform:""},e),s={},u=S(t[0],t[1]),c=1.5*Math.PI,l=Math.PI/180,f=100/a.circleSteps,h=360/a.circleSteps,p=0;p<=a.circleSteps;p+=1){r=c+h*p*l,o=n;var y={x:(y=u).x+o*Math.cos(r),y:y.y+o*Math.sin(r)};s["".concat(Math.round(f*p),"%")]={transform:"translate(".concat(y.x,"px,").concat(y.y,"px) ").concat(a.transform)}}for(i in e){var m,d=e[i];for(m in s){var v=s[m];if(i===m&&v.transform&&d.transform){s[m].transform="".concat(v.transform," ").concat(d.transform);break}}}return Object.assign({},e,s)},e.isBrowser&&(e=window).Keyframes&&(e.Keyframes.bezierPath=n.bezierPath,e.Keyframes.circlePath=n.circlePath)},{"./keyframes":2}],4:[function(e,t,n){var f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},h=function(e,t){var n={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},e=(Object.defineProperty(n,"__esModule",{value:!0}),n.playSpriteSheet=n.spriteSheet=void 0,e("./keyframes"));n.spriteSheet=function(e){for(var t=e.rows,t=void 0===t?1:t,n=e.cols,n=void 0===n?1:n,r=e.width,r=void 0===r?0:r,o=e.height,o=void 0===o?0:o,e=h(e,["rows","cols","width","height"]),i=f(f(f({},{offsetX:0,offsetY:0,count:t*n,spriteWidth:r/n,spriteHeight:o/t,loop:!0}),{rows:t,cols:n,width:r,height:o}),e),a=100/i.count,s={},u=i.offsetX,c=i.offsetY,l=0;l<i.count;l+=1)s["".concat(Math.round(a*l),"%")]={backgroundPosition:"-".concat(u,"px -").concat(c,"px")},u>=i.width-i.spriteWidth?c+=i.spriteHeight:u+=i.spriteWidth;return Object.assign({},{name:i.name},s)};n.playSpriteSheet=function(e,t,n){return"number"==typeof(n=void 0===n?"infinite":n)&&n<0&&(n="infinite"),"".concat(e," ").concat(t," steps(1) ").concat(n)},e.isBrowser&&(e=window).Keyframes&&(e.Keyframes.spriteSheet=n.spriteSheet,e.Keyframes.playSpriteSheet=n.playSpriteSheet)},{"./keyframes":2}],5:[function(e,t,n){var r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};t.exports=function(e,t){return"number"!=typeof t||r[e]?t:t+"px"}},{}],6:[function(e,t,n){var r=/[A-Z]/g,o=/^ms-/,i={};function a(e){return"-"+e.toLowerCase()}t.exports=function(e){var t;return i.hasOwnProperty(e)?i[e]:(t=e.replace(r,a),i[e]=o.test(t)?"-"+t:t)}},{}]},{},[1]);