-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathVueTween.js
1 lines (1 loc) · 1.72 KB
/
VueTween.js
1
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.VueTween=b()})(this,function(){"use strict";function a(a){return function(){return a}}function b(a){return"function"==typeof a}function c(c){return b(c)?c:a(c)}function d(a){return a}function e(a){return a&&"object"==typeof a}function f(a,b){var c={};return Object.entries(a).forEach(function(a){var d=a[0],e=a[1];c[d]=b(e,d)}),c}function g(a,b){var c=!0,d=function(){requestAnimationFrame(function(){!1===a()?c=!0:setTimeout(d,b)})};return function(){c&&(c=!1,d())}}var h=function(a){return Array.isArray(a)?a.map(h):e(a)?f(a,h):a},i=function(a,b,c){var d=Math.round,g=Number.isInteger,h=Number.isFinite;if(Array.isArray(a)&&Array.isArray(b))return a.map(function(a,d){return i(a,b[d],c)});if(e(a)&&e(b))return f(a,function(a,d){return i(a,b[d],c)});if(h(a)&&h(b)){var j=b+(a-b)*c;return g(a)&&g(b)&&(j=d(j)),j}return a},j="tweened_",k=j+"start_",l=j+"frame_",m={install:function(a){Object.assign(a.config.optionMergeStrategies,{tweened:function(a,b){return Object.assign({},b,a)}}),a.mixin(this)},data:function a(){var b=this,e=b.$options,a={},f=e.computed,j=e.tweened;return j&&Object.entries(j).forEach(function(b){var e,j=b[0],m=b[1],n=m.get,o=m.duration,p=m.easing;void 0===p&&(p=d),o=c(o);var q,r,s,u,v,w;Object.assign(f,(e={},e[k+j]=function(){var a=this;w?(r=q,s=h(n.call(this)),u=Date.now(),v=o.call(this),w()):(w=g(function(){if(a._isDestroyed)return!1;var b=Date.now()-u;if(b<v){var c=p(b/v);q=i(s,r,c),a[l+j]={}}else return q=s,a[l+j]={},!1}),q=h(n.call(this)))},e[j]=function(){return this[k+j],this[l+j],q},e)),a[l+j]={}}),a},computed:{}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(m),m});