popmotion
Advanced tools
Comparing version 9.0.0-rc.3 to 9.0.0-rc.4
@@ -70,4 +70,6 @@ import { __assign, __spreadArrays, __rest } from 'tslib'; | ||
restSpeed = _h === void 0 ? 0.005 : _h, | ||
_j = _a.restDelta, | ||
restDelta = _j === void 0 ? 0.5 : _j; | ||
restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) < 1 ? 0.01 : 0.5; | ||
} | ||
this.options = { | ||
@@ -74,0 +76,0 @@ from: from, |
@@ -110,3 +110,6 @@ (function (global, factory) { | ||
SpringAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 0.005 : _h, _j = _a.restDelta, restDelta = _j === void 0 ? 0.5 : _j; | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 0.005 : _h, restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) < 1 ? 0.01 : 0.5; | ||
} | ||
this.options = { | ||
@@ -113,0 +116,0 @@ from: from, |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).popmotion={})}(this,function(t){"use strict";var q=function(){return(q=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};var n=(r.prototype.createSpring=function(){var r,t=this.options,n=t.velocity,e=t.from,o=t.to,i=t.damping,a=t.stiffness,u=t.mass,s=n?-n/1e3:0,f=o-e,p=i/(2*Math.sqrt(a*u)),c=Math.sqrt(a/u)/1e3;p<1?this.resolveSpring=function(t){var n=Math.exp(-p*c*t),r=c*Math.sqrt(1-p*p);return o-n*((s+p*c*f)/r*Math.sin(r*t)+f*Math.cos(r*t))}:1==p?this.resolveSpring=function(t){var n=Math.exp(-c*t);return o-n*(1+c*t)}:(r=c*Math.sqrt(p*p-1),this.resolveSpring=function(t){var n=Math.exp(-p*c*t);return o-n*((s+p*c*f)*Math.sinh(r*t)+r*f*Math.cosh(r*t))/r})},r.prototype.update=function(t){var n=this.resolveSpring(t),r=this.options,e=r.velocity,o=r.restSpeed,i=r.restDelta,a=r.to,u=Math.abs(e)<=o,s=Math.abs(a-n)<=i;return this.isComplete=u&&s,this.isComplete?a:n},r.prototype.updateOptions=function(t){var n=t.from,r=void 0===n?0:n,e=t.to,o=void 0===e?0:e,i=t.velocity,a=void 0===i?0:i,u=t.stiffness,s=void 0===u?100:u,f=t.damping,p=void 0===f?10:f,c=t.mass,v=void 0===c?1:c,d=t.restSpeed,l=void 0===d?.005:d,h=t.restDelta,m=void 0===h?.5:h;this.options={from:r,to:o,velocity:a,stiffness:s,damping:p,mass:v,restSpeed:l,restDelta:m}},r.prototype.flipTarget=function(){var t=this.options,n=t.from,r=t.to,e=t.velocity;this.options.velocity=-e,this.options.from=r,this.options.to=n,this.createSpring()},r.needsInterpolation=function(t,n){return"string"==typeof t||"string"==typeof n},r.uniqueOptionKeys=new Set(["velocity","stiffness","damping","mass","restSpeed","restDelta"]),r);function r(t){this.isComplete=!1,this.updateOptions(t),this.createSpring()}function s(t,n,r){return-r*t+r*n+t}function e(n,r){return function(t){return Math.max(Math.min(t,r),n)}}function c(t){return t%1?Number(t.toFixed(5)):t}function o(t){return void 0!==t.red}function i(t){return void 0!==t.hue}var a,b=function(t,n,r){var e=n-t;return 0==e?1:(r-t)/e},f=/(-)?(\d[\d\.]*)/g,p=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,u=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,v={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},d=q(q({},v),{transform:e(0,1)}),l=(q(q({},v),{default:1}),a="%",{test:function(t){return"string"==typeof t&&t.endsWith(a)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+a}}),h=(q(q({},l),{parse:function(t){return l.parse(t)/100},transform:function(t){return l.transform(100*t)}}),e(0,255));function m(i){return function(t){if("string"!=typeof t)return t;for(var n,r={},e=(n=t).substring(n.indexOf("(")+1,n.lastIndexOf(")")).replace(/(,|\/)/g," ").split(/ \s*/),o=0;o<4;o++)r[i[o]]=void 0!==e[o]?parseFloat(e[o]):1;return r}}var y=q(q({},v),{transform:function(t){return Math.round(h(t))}});function g(t,n){return t.startsWith(n)&&u.test(t)}function M(t){return"number"==typeof t?0:t}function x(t,n,r){var e=t*t,o=n*n;return Math.sqrt(Math.max(0,r*(o-e)+e))}function O(n){return U.find(function(t){return t.test(n)})}function w(t){return"number"==typeof t}function S(n,r){return function(t){return r(n(t))}}var I={test:function(t){return"string"==typeof t?g(t,"rgb"):o(t)},parse:m(["red","green","blue","alpha"]),transform:function(t){var n,r,e,o,i,a=t.red,u=t.green,s=t.blue,f=t.alpha,p=void 0===f?1:f;return n={red:y.transform(a),green:y.transform(u),blue:y.transform(s),alpha:c(d.transform(p))},r=n.red,e=n.green,o=n.blue,i=n.alpha,"rgba("+r+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},C={test:function(t){return"string"==typeof t?g(t,"hsl"):i(t)},parse:m(["hue","saturation","lightness","alpha"]),transform:function(t){var n,r,e,o,i,a=t.hue,u=t.saturation,s=t.lightness,f=t.alpha,p=void 0===f?1:f;return n={hue:Math.round(a),saturation:l.transform(c(u)),lightness:l.transform(c(s)),alpha:c(d.transform(p))},r=n.hue,e=n.saturation,o=n.lightness,i=n.alpha,"hsla("+r+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},A=q(q({},I),{test:function(t){return"string"==typeof t&&g(t,"#")},parse:function(t){var n="",r="",e="";return 4<t.length?(n=t.substr(1,2),r=t.substr(3,2),e=t.substr(5,2)):(n=t.substr(1,1),r=t.substr(2,1),e=t.substr(3,1),n+=n,r+=r,e+=e),{red:parseInt(n,16),green:parseInt(r,16),blue:parseInt(e,16),alpha:1}}}),D={test:function(t){return"string"==typeof t&&u.test(t)||o(t)||i(t)},parse:function(t){return I.test(t)?I.parse(t):C.test(t)?C.parse(t):A.test(t)?A.parse(t):t},transform:function(t){return o(t)?I.transform(t):i(t)?C.transform(t):t}},P="${c}",T="${n}",F={test:function(t){if("string"!=typeof t||!isNaN(t))return!1;var n=0,r=t.match(f),e=t.match(p);return r&&(n+=r.length),e&&(n+=e.length),0<n},parse:function(t){var n=t,r=[],e=n.match(p);e&&(n=n.replace(p,P),r.push.apply(r,e.map(D.parse)));var o=n.match(f);return o&&r.push.apply(r,o.map(v.parse)),r},createTransformer:function(t){var e=t,o=0,n=t.match(p),i=n?n.length:0;if(n)for(var r=0;r<i;r++)e=e.replace(n[r],P),o++;var a=e.match(f),u=a?a.length:0;if(a)for(r=0;r<u;r++)e=e.replace(a[r],T),o++;return function(t){for(var n=e,r=0;r<o;r++)n=n.replace(r<i?P:T,r<i?D.transform(t[r]):c(t[r]));return n}},getAnimatableNone:function(t){var n=F.parse(t);return F.createTransformer(t)(n.map(M))}},R=function(){},U=[A,I,C],j=function(t,n){var r=O(t),e=O(n);R(r.transform===e.transform);var o=r.parse(t),i=e.parse(n),a=q({},o),u=r===C?s:x;return function(t){for(var n in a)"alpha"!==n&&(a[n]=u(o[n],i[n],t));return a.alpha=s(o.alpha,i.alpha,t),r.transform(a)}},k={x:0,y:0,z:0},E=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.reduce(S)};function z(n,r){return w(n)?function(t){return s(n,r,t)}:(D.test(n)?j:B)(n,r)}var K=function(t,r){var e=function(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;for(var e=Array(t),o=0,n=0;n<r;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)e[o]=i[a];return e}(t),o=e.length,i=t.map(function(t,n){return z(t,r[n])});return function(t){for(var n=0;n<o;n++)e[n]=i[n](t);return e}},N=function(t,n){var r=q(q({},t),n),e={};for(var o in r)void 0!==t[o]&&void 0!==n[o]&&(e[o]=z(t[o],n[o]));return function(t){for(var n in e)r[n]=e[n](t);return r}};function W(t){for(var n=F.parse(t),r=n.length,e=0,o=0,i=0,a=0;a<r;a++)e||"number"==typeof n[a]?e++:void 0!==n[a].hue?i++:o++;return{parsed:n,numNumbers:e,numRGB:o,numHSL:i}}var B=function(t,n){var r=F.createTransformer(n),e=W(t),o=W(n);return E(K(e.parsed,o.parsed),r)},$=function(t,n,r){return Math.min(Math.max(r,t),n)},_=function(n,r){return function(t){return s(n,r,t)}};function G(t,n,r){for(var e,o=[],i=r||("number"==typeof(e=t[0])?_:"string"==typeof e?D.test(e)?j:B:Array.isArray(e)?K:"object"==typeof e?N:void 0),a=t.length-1,u=0;u<a;u++){var s,f=i(t[u],t[u+1]);n&&(s=Array.isArray(n)?n[u]:n,f=E(s,f)),o.push(f)}return o}function H(n,t,r){var e=void 0===r?{}:r,o=e.clamp,i=void 0===o||o,a=e.ease,u=e.mixer,s=n.length;R(s===t.length),R(!a||!Array.isArray(a)||a.length===s-1),n[0]>n[s-1]&&(n=[].concat(n),t=[].concat(t),n.reverse(),t.reverse());var f,p,c,v,d,l,h,m,y,g=G(t,a,u),M=2===s?(l=g,h=(d=n)[0],m=d[1],y=l[0],function(t){return y(b(h,m,t))}):(p=g,c=(f=n).length,v=c-1,function(t){var n=0,r=!1;if(t<=f[0]?r=!0:t>=f[v]&&(n=v-1,r=!0),!r){for(var e=1;e<c&&!(f[e]>t||e===v);e++);n=e-1}var o=b(f[n],f[n+1],t);return p[n](o)});return i?function(t){return M($(n[0],n[s-1],t))}:M}function L(n){return function(t){return 1-n(1-t)}}function V(n){return function(t){return t<=.5?n(2*t)/2:(2-n(2*(1-t)))/2}}function J(n){return function(t){return Math.pow(t,n)}}function Q(n){return function(t){return t*t*((n+1)*t-n)}}function X(t){var n=Q(t);return function(t){return(t*=2)<1?.5*n(t):.5*(2-Math.pow(2,-10*(t-1)))}}function Y(t){return t}function Z(t){return 1-Math.sin(Math.acos(t))}function tt(t){if(1===t||0===t)return t;var n=t*t;return t<4/11?7.5625*n:t<8/11?9.075*n-9.9*t+3.4:t<.9?4356/361*n-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}var nt=J(2),rt=L(nt),et=V(nt),ot=L(Z),it=V(ot),at=Q(1.525),ut=L(at),st=V(at),ft=X(1.525),pt=L(tt);var ct=(vt.prototype.createInterpolator=function(){var t,n,r,e,o,i=this.options,a=i.duration,u=i.ease,s=i.offset,u=Array.isArray(u)?u:(t=this.values,n=u,t.map(function(){return n||et}).splice(0,t.length-1)),s=s||(r=this.values,e=r.length,r.map(function(t,n){return 0!==n?n/(e-1):0})),f=(o=a,s.map(function(t){return t*o}));this.interpolator=H(f,this.values,{ease:u})},vt.prototype.update=function(t){var n=this.options.duration;return this.isComplete=n<=t,this.interpolator(t)},vt.prototype.updateOptions=function(t){var n=t.from,r=void 0===n?0:n,e=t.to,o=void 0===e?1:e,i=t.ease,a=t.offset,u=t.duration,s=void 0===u?300:u;this.options={from:r,to:o,ease:i,offset:a,duration:s}},vt.prototype.flipTarget=function(){this.values.reverse(),this.createInterpolator()},vt.needsInterpolation=function(){return!1},vt.uniqueOptionKeys=new Set(["duration","ease"]),vt);function vt(t){this.isComplete=!1,this.updateOptions(t);var n=this.options,r=n.from,e=n.to;this.values=Array.isArray(e)?e:[r,e],this.createInterpolator()}var dt=(lt.prototype.flipTarget=function(){},lt.prototype.update=function(t){var n=this.options,r=n.timeConstant,e=n.restDelta,o=-this.amplitude*Math.exp(-t/r);return this.isComplete=!(e<o||o<-e),this.isComplete?this.target:this.target+o},lt.prototype.updateOptions=function(t){var n=void 0===t?{}:t,r=n.velocity,e=void 0===r?0:r,o=n.from,i=void 0===o?0:o,a=n.power,u=void 0===a?.8:a,s=n.timeConstant,f=void 0===s?350:s,p=n.restDelta,c=void 0===p?.5:p,v=n.modifyTarget;this.options={velocity:e,from:i,power:u,timeConstant:f,restDelta:c,modifyTarget:v}},lt.needsInterpolation=function(){return!1},lt.uniqueOptionKeys=new Set(["power","timeConstant","modifyTarget"]),lt);function lt(t){this.isComplete=!1,this.updateOptions(t);var n=this.options,r=n.power,e=n.velocity,o=n.modifyTarget,i=n.from,a=r*e,u=i+a,s=void 0===o?u:o(u);s!==u&&(a=s-i),this.target=s,this.amplitude=a}var ht=[ct,dt,n],mt={keyframes:ct,spring:n,decay:dt},yt=ht.length;var gt,Mt,bt=0,xt="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var n=Date.now(),r=Math.max(0,16.7-(n-bt));bt=n+r,setTimeout(function(){return t(bt)},r)};(Mt=gt=gt||{}).Read="read",Mt.Update="update",Mt.Render="render",Mt.PostRender="postRender",Mt.FixedUpdate="fixedUpdate";function Ot(t){return Ct=t}function wt(t){return qt[t].process(Dt)}var St=1/60*1e3,It=!0,Ct=!1,At=!1,Dt={delta:0,timestamp:0},Pt=[gt.Read,gt.Update,gt.Render,gt.PostRender],Tt=Pt.reduce(function(t,n){var e,i,a,u,s,o,f,p,c,v=(e=Ot,i=[],s=!(a=[]),o=u=0,f=new WeakSet,p=new WeakSet,c={cancel:function(t){var n=a.indexOf(t);f.add(t),-1!==n&&a.splice(n,1)},process:function(t){var n,r;if(s=!0,i=(n=[a,i])[0],(a=n[1]).length=0,u=i.length)for(o=0;o<u;o++)(r=i[o])(t),!0!==p.has(r)||f.has(r)||(c.schedule(r),e(!0));s=!1},schedule:function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var e=r&&s,o=e?i:a;f.delete(t),n&&p.add(t),-1===o.indexOf(t)&&(o.push(t),e&&(u=i.length))}});return t.sync[n]=function(t,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!1),Ct||jt(),v.schedule(t,n,r),t},t.cancelSync[n]=function(t){return v.cancel(t)},t.steps[n]=v,t},{steps:{},sync:{},cancelSync:{}}),qt=Tt.steps,Ft=Tt.sync,Rt=Tt.cancelSync,Ut=function(t){Ct=!1,Dt.delta=It?St:Math.max(Math.min(t-Dt.timestamp,40),1),It||(St=Dt.delta),Dt.timestamp=t,At=!0,Pt.forEach(wt),At=!1,Ct&&(It=!1,xt(Ut))},jt=function(){It=Ct=!0,At||xt(Ut)};function kt(t,n,r){return void 0===r&&(r=0),t-n-r}var Et=function(r){function t(t){var n=t.delta;return r(n)}return{start:function(){return Ft.update(t,!0,!0)},stop:function(){return Rt.update(t)}}};function zt(t){var i,a,n=t.from,r=t.to,e=t.autoplay,o=void 0===e||e,u=t.driver,s=void 0===u?Et:u,f=t.elapsed,p=void 0===f?0:f,c=t.repeat,v=void 0===c?0:c,d=t.repeatType,l=void 0===d?"loop":d,h=t.repeatDelay,m=void 0===h?0:h,y=t.onPlay,g=t.onStop,M=t.onComplete,b=t.onRepeat,x=t.onUpdate,O=function(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]]);return r}(t,["from","to","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),w=0,S=O.duration,I=!0,C=function(t){if(mt[t.type])return mt[t.type];for(var n in t)for(var r=0;r<yt;r++){var e=ht[r];if(e.uniqueOptionKeys.has(n))return e}return ct}(O);C.needsInterpolation(n,r)&&(a=H([0,100],[n,r],{clamp:!1}),n=0,r=100);var A=new C(q(q({},O),{from:n,to:r}));function D(){var t,n,r,e;w++,"reverse"===l?(t=p,n=S,void 0===(r=m)&&(r=0),void 0===(e=I=w%2==0)&&(e=!0),p=e?kt(n+-t,n,r):n-(t-n)+r):(p=kt(p,S,m),"mirror"===l&&A.flipTarget()),A.isComplete=!1,b&&b()}function P(t){I||(t=-t),p+=t;var n,r,e,o=A.update(Math.max(0,p));a&&(o=a(o)),null!==x&&void 0!==x&&x(o),(I?A.isComplete:p<=0)&&(0===w&&void 0===S&&(S=p),w<v?(n=p,r=S,e=m,(I?r+e<=n:n<=-e)&&D()):(i.stop(),M&&M()))}function T(){null!==y&&void 0!==y&&y(),(i=s(P)).start()}return o&&T(),{play:T,pause:function(){},resume:function(){},reverse:function(){},seek:function(){},stop:function(){null!==g&&void 0!==g&&g(),i.stop()}}}function Kt(t,n){return n?t*(1e3/n):0}function Nt(t){return 180*t/Math.PI}function Wt(t){return t}function Bt(i){return void 0===i&&(i=Wt),function(t,n,r){var e=n-r,o=-(0-t+1)*(0-i(Math.abs(e)));return e<=0?n+o:n-o}}function $t(t){return t*Math.PI/180}function _t(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")}function Gt(t){return _t(t)&&t.hasOwnProperty("z")}function Ht(t,n){return Math.abs(t-n)}var Lt=Bt(),Vt=Bt(Math.sqrt);function Jt(t,n){return void 0===n&&(n=2),n=Math.pow(10,n),Math.round(t*n)/n}function Qt(t,n,r,e){return void 0===e&&(e=0),Jt(t+r*(n-t)/Math.max(e,r))}function Xt(t,n){return 1-3*n+3*t}function Yt(t,n){return 3*n-6*t}var Zt=function(t,n,r){return((Xt(n,r)*t+Yt(n,r))*t+3*n)*t},tn=function(t,n,r){return 3*Xt(n,r)*t*t+2*Yt(n,r)*t+3*n},nn=1e-7,rn=10;var en=8;t.DecayAnimator=dt,t.KeyframesAnimator=ct,t.SpringAnimator=n,t.angle=function(t,n){return void 0===n&&(n=k),Nt(Math.atan2(n.y-t.y,n.x-t.x))},t.animate=zt,t.anticipate=ft,t.applyOffset=function(n,r){var e=!0;return void 0===r&&(r=n,e=!1),function(t){return e?t-n+r:(n=t,e=!0,r)}},t.attract=Lt,t.attractExpo=Vt,t.backIn=at,t.backInOut=st,t.backOut=ut,t.bounceIn=pt,t.bounceInOut=function(t){return t<.5?.5*(1-tt(1-2*t)):.5*tt(2*t-1)+.5},t.bounceOut=tt,t.circIn=Z,t.circInOut=it,t.circOut=ot,t.clamp=$,t.createAnticipate=X,t.createAttractor=Bt,t.createBackIn=Q,t.createExpoIn=J,t.cubicBezier=function(i,n,a,r){if(i===n&&a===r)return Y;for(var u=new Float32Array(11),t=0;t<11;++t)u[t]=Zt(.1*t,i,a);function e(t){for(var n=0,r=1;10!==r&&u[r]<=t;++r)n+=.1;var e=n+.1*((t-u[--r])/(u[r+1]-u[r])),o=tn(e,i,a);return.001<=o?function(t,n,r,e){for(var o=0;o<en;++o){var i=tn(n,r,e);if(0===i)return n;n-=(Zt(n,r,e)-t)/i}return n}(t,e,i,a):0===o?e:function(t,n,r,e,o){for(var i,a,u=0;0<(i=Zt(a=n+(r-n)/2,e,o)-t)?r=a:n=a,Math.abs(i)>nn&&++u<rn;);return a}(t,n,n+.1,i,a)}return function(t){return 0===t||1===t?t:Zt(e(t),n,r)}},t.degreesToRadians=$t,t.distance=function(t,n){if(w(t)&&w(n))return Ht(t,n);if(_t(t)&&_t(n)){var r=Ht(t.x,n.x),e=Ht(t.y,n.y),o=Gt(t)&&Gt(n)?Ht(t.z,n.z):0;return Math.sqrt(Math.pow(r,2)+Math.pow(e,2)+Math.pow(o,2))}},t.easeIn=nt,t.easeInOut=et,t.easeOut=rt,t.inertia=function(t){var n,r,e,o,i,a=t.from,u=void 0===a?0:a,s=t.velocity,f=void 0===s?0:s,p=t.min,c=t.max,v=t.power,d=void 0===v?.8:v,l=t.timeConstant,h=void 0===l?750:l,m=t.bounceStiffness,y=void 0===m?500:m,g=t.bounceDamping,M=void 0===g?10:g,b=t.restDelta,x=void 0===b?1:b,O=t.modifyTarget,w=t.driver,S=t.onUpdate,I=t.onComplete;function C(t){return void 0!==p&&t<p||void 0!==c&&c<t}function A(t){return void 0!==p&&(void 0===c||Math.abs(p-t)<Math.abs(c-t))?p:c}function D(r){null!==n&&void 0!==n&&n.stop(),n=zt(q(q({},r),{driver:w,onUpdate:function(t){var n;null!==S&&void 0!==S&&S(t),null!==(n=r.onUpdate)&&void 0!==n&&n.call(r,t)},onComplete:I}))}function P(t){D(q({type:"spring",stiffness:y,damping:M,restDelta:x},t))}return C(u)?P({from:u,velocity:f,to:A(u)}):(r=d*f+u,void 0!==O&&(r=O(r)),e=A(r),o=e===p?-1:1,D({type:"decay",from:u,velocity:f,timeConstant:h,power:d,restDelta:x,modifyTarget:O,onUpdate:C(r)?function(t){f=Kt(t-i,Dt.delta),0<e-(i=t)*o||P({from:i,to:e,velocity:f})}:void 0})),{stop:function(){return null===n||void 0===n?void 0:n.stop()}}},t.interpolate=H,t.isPoint=_t,t.isPoint3D=Gt,t.linear=Y,t.mirrorEasing=V,t.mix=s,t.mixColor=j,t.mixComplex=B,t.pipe=E,t.pointFromVector=function(t,n,r){return n=$t(n),{x:r*Math.cos(n)+t.x,y:r*Math.sin(n)+t.y}},t.progress=b,t.radiansToDegrees=Nt,t.reverseEasing=L,t.smooth=function(o){void 0===o&&(o=50);var i=0,a=0;return function(t){var n=Dt.timestamp,r=n!==a?n-a:0,e=r?Qt(i,t,r,o):i;return a=n,i=e}},t.smoothFrame=Qt,t.snap=function(o){if("number"==typeof o)return function(t){return Math.round(t/o)*o};var i=0,a=o.length;return function(t){var n=Math.abs(o[0]-t);for(i=1;i<a;i++){var r=o[i],e=Math.abs(r-t);if(0===e)return r;if(n<e)return o[i-1];if(i===a-1)return r;n=e}}},t.steps=function(e,o){return void 0===o&&(o="end"),function(t){var n=(t="end"===o?Math.min(t,.999):Math.max(t,.001))*e,r="end"===o?Math.floor(n):Math.ceil(n);return $(0,1,r/e)}},t.toDecimal=Jt,t.velocityPerFrame=function(t,n){return t/(1e3/n)},t.velocityPerSecond=Kt,t.wrap=function(t,n,r){var e=n-t;return((r-t)%e+e)%e+t},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).popmotion={})}(this,function(t){"use strict";var q=function(){return(q=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};var n=(r.prototype.createSpring=function(){var r,t=this.options,n=t.velocity,e=t.from,o=t.to,i=t.damping,a=t.stiffness,u=t.mass,s=n?-n/1e3:0,f=o-e,p=i/(2*Math.sqrt(a*u)),c=Math.sqrt(a/u)/1e3;p<1?this.resolveSpring=function(t){var n=Math.exp(-p*c*t),r=c*Math.sqrt(1-p*p);return o-n*((s+p*c*f)/r*Math.sin(r*t)+f*Math.cos(r*t))}:1==p?this.resolveSpring=function(t){var n=Math.exp(-c*t);return o-n*(1+c*t)}:(r=c*Math.sqrt(p*p-1),this.resolveSpring=function(t){var n=Math.exp(-p*c*t);return o-n*((s+p*c*f)*Math.sinh(r*t)+r*f*Math.cosh(r*t))/r})},r.prototype.update=function(t){var n=this.resolveSpring(t),r=this.options,e=r.velocity,o=r.restSpeed,i=r.restDelta,a=r.to,u=Math.abs(e)<=o,s=Math.abs(a-n)<=i;return this.isComplete=u&&s,this.isComplete?a:n},r.prototype.updateOptions=function(t){var n=t.from,r=void 0===n?0:n,e=t.to,o=void 0===e?0:e,i=t.velocity,a=void 0===i?0:i,u=t.stiffness,s=void 0===u?100:u,f=t.damping,p=void 0===f?10:f,c=t.mass,v=void 0===c?1:c,d=t.restSpeed,l=void 0===d?.005:d,h=t.restDelta;void 0===h&&(h=Math.abs(o-r)<1?.01:.5),this.options={from:r,to:o,velocity:a,stiffness:s,damping:p,mass:v,restSpeed:l,restDelta:h}},r.prototype.flipTarget=function(){var t=this.options,n=t.from,r=t.to,e=t.velocity;this.options.velocity=-e,this.options.from=r,this.options.to=n,this.createSpring()},r.needsInterpolation=function(t,n){return"string"==typeof t||"string"==typeof n},r.uniqueOptionKeys=new Set(["velocity","stiffness","damping","mass","restSpeed","restDelta"]),r);function r(t){this.isComplete=!1,this.updateOptions(t),this.createSpring()}function s(t,n,r){return-r*t+r*n+t}function e(n,r){return function(t){return Math.max(Math.min(t,r),n)}}function c(t){return t%1?Number(t.toFixed(5)):t}function o(t){return void 0!==t.red}function i(t){return void 0!==t.hue}var a,b=function(t,n,r){var e=n-t;return 0==e?1:(r-t)/e},f=/(-)?(\d[\d\.]*)/g,p=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,u=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,v={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},d=q(q({},v),{transform:e(0,1)}),l=(q(q({},v),{default:1}),a="%",{test:function(t){return"string"==typeof t&&t.endsWith(a)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+a}}),h=(q(q({},l),{parse:function(t){return l.parse(t)/100},transform:function(t){return l.transform(100*t)}}),e(0,255));function m(i){return function(t){if("string"!=typeof t)return t;for(var n,r={},e=(n=t).substring(n.indexOf("(")+1,n.lastIndexOf(")")).replace(/(,|\/)/g," ").split(/ \s*/),o=0;o<4;o++)r[i[o]]=void 0!==e[o]?parseFloat(e[o]):1;return r}}var y=q(q({},v),{transform:function(t){return Math.round(h(t))}});function g(t,n){return t.startsWith(n)&&u.test(t)}function M(t){return"number"==typeof t?0:t}function x(t,n,r){var e=t*t,o=n*n;return Math.sqrt(Math.max(0,r*(o-e)+e))}function O(n){return U.find(function(t){return t.test(n)})}function w(t){return"number"==typeof t}function S(n,r){return function(t){return r(n(t))}}var I={test:function(t){return"string"==typeof t?g(t,"rgb"):o(t)},parse:m(["red","green","blue","alpha"]),transform:function(t){var n,r,e,o,i,a=t.red,u=t.green,s=t.blue,f=t.alpha,p=void 0===f?1:f;return n={red:y.transform(a),green:y.transform(u),blue:y.transform(s),alpha:c(d.transform(p))},r=n.red,e=n.green,o=n.blue,i=n.alpha,"rgba("+r+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},C={test:function(t){return"string"==typeof t?g(t,"hsl"):i(t)},parse:m(["hue","saturation","lightness","alpha"]),transform:function(t){var n,r,e,o,i,a=t.hue,u=t.saturation,s=t.lightness,f=t.alpha,p=void 0===f?1:f;return n={hue:Math.round(a),saturation:l.transform(c(u)),lightness:l.transform(c(s)),alpha:c(d.transform(p))},r=n.hue,e=n.saturation,o=n.lightness,i=n.alpha,"hsla("+r+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},A=q(q({},I),{test:function(t){return"string"==typeof t&&g(t,"#")},parse:function(t){var n="",r="",e="";return 4<t.length?(n=t.substr(1,2),r=t.substr(3,2),e=t.substr(5,2)):(n=t.substr(1,1),r=t.substr(2,1),e=t.substr(3,1),n+=n,r+=r,e+=e),{red:parseInt(n,16),green:parseInt(r,16),blue:parseInt(e,16),alpha:1}}}),D={test:function(t){return"string"==typeof t&&u.test(t)||o(t)||i(t)},parse:function(t){return I.test(t)?I.parse(t):C.test(t)?C.parse(t):A.test(t)?A.parse(t):t},transform:function(t){return o(t)?I.transform(t):i(t)?C.transform(t):t}},P="${c}",T="${n}",F={test:function(t){if("string"!=typeof t||!isNaN(t))return!1;var n=0,r=t.match(f),e=t.match(p);return r&&(n+=r.length),e&&(n+=e.length),0<n},parse:function(t){var n=t,r=[],e=n.match(p);e&&(n=n.replace(p,P),r.push.apply(r,e.map(D.parse)));var o=n.match(f);return o&&r.push.apply(r,o.map(v.parse)),r},createTransformer:function(t){var e=t,o=0,n=t.match(p),i=n?n.length:0;if(n)for(var r=0;r<i;r++)e=e.replace(n[r],P),o++;var a=e.match(f),u=a?a.length:0;if(a)for(r=0;r<u;r++)e=e.replace(a[r],T),o++;return function(t){for(var n=e,r=0;r<o;r++)n=n.replace(r<i?P:T,r<i?D.transform(t[r]):c(t[r]));return n}},getAnimatableNone:function(t){var n=F.parse(t);return F.createTransformer(t)(n.map(M))}},R=function(){},U=[A,I,C],j=function(t,n){var r=O(t),e=O(n);R(r.transform===e.transform);var o=r.parse(t),i=e.parse(n),a=q({},o),u=r===C?s:x;return function(t){for(var n in a)"alpha"!==n&&(a[n]=u(o[n],i[n],t));return a.alpha=s(o.alpha,i.alpha,t),r.transform(a)}},k={x:0,y:0,z:0},E=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.reduce(S)};function z(n,r){return w(n)?function(t){return s(n,r,t)}:(D.test(n)?j:B)(n,r)}var K=function(t,r){var e=function(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;for(var e=Array(t),o=0,n=0;n<r;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)e[o]=i[a];return e}(t),o=e.length,i=t.map(function(t,n){return z(t,r[n])});return function(t){for(var n=0;n<o;n++)e[n]=i[n](t);return e}},N=function(t,n){var r=q(q({},t),n),e={};for(var o in r)void 0!==t[o]&&void 0!==n[o]&&(e[o]=z(t[o],n[o]));return function(t){for(var n in e)r[n]=e[n](t);return r}};function W(t){for(var n=F.parse(t),r=n.length,e=0,o=0,i=0,a=0;a<r;a++)e||"number"==typeof n[a]?e++:void 0!==n[a].hue?i++:o++;return{parsed:n,numNumbers:e,numRGB:o,numHSL:i}}var B=function(t,n){var r=F.createTransformer(n),e=W(t),o=W(n);return E(K(e.parsed,o.parsed),r)},$=function(t,n,r){return Math.min(Math.max(r,t),n)},_=function(n,r){return function(t){return s(n,r,t)}};function G(t,n,r){for(var e,o=[],i=r||("number"==typeof(e=t[0])?_:"string"==typeof e?D.test(e)?j:B:Array.isArray(e)?K:"object"==typeof e?N:void 0),a=t.length-1,u=0;u<a;u++){var s,f=i(t[u],t[u+1]);n&&(s=Array.isArray(n)?n[u]:n,f=E(s,f)),o.push(f)}return o}function H(n,t,r){var e=void 0===r?{}:r,o=e.clamp,i=void 0===o||o,a=e.ease,u=e.mixer,s=n.length;R(s===t.length),R(!a||!Array.isArray(a)||a.length===s-1),n[0]>n[s-1]&&(n=[].concat(n),t=[].concat(t),n.reverse(),t.reverse());var f,p,c,v,d,l,h,m,y,g=G(t,a,u),M=2===s?(l=g,h=(d=n)[0],m=d[1],y=l[0],function(t){return y(b(h,m,t))}):(p=g,c=(f=n).length,v=c-1,function(t){var n=0,r=!1;if(t<=f[0]?r=!0:t>=f[v]&&(n=v-1,r=!0),!r){for(var e=1;e<c&&!(f[e]>t||e===v);e++);n=e-1}var o=b(f[n],f[n+1],t);return p[n](o)});return i?function(t){return M($(n[0],n[s-1],t))}:M}function L(n){return function(t){return 1-n(1-t)}}function V(n){return function(t){return t<=.5?n(2*t)/2:(2-n(2*(1-t)))/2}}function J(n){return function(t){return Math.pow(t,n)}}function Q(n){return function(t){return t*t*((n+1)*t-n)}}function X(t){var n=Q(t);return function(t){return(t*=2)<1?.5*n(t):.5*(2-Math.pow(2,-10*(t-1)))}}function Y(t){return t}function Z(t){return 1-Math.sin(Math.acos(t))}function tt(t){if(1===t||0===t)return t;var n=t*t;return t<4/11?7.5625*n:t<8/11?9.075*n-9.9*t+3.4:t<.9?4356/361*n-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}var nt=J(2),rt=L(nt),et=V(nt),ot=L(Z),it=V(ot),at=Q(1.525),ut=L(at),st=V(at),ft=X(1.525),pt=L(tt);var ct=(vt.prototype.createInterpolator=function(){var t,n,r,e,o,i=this.options,a=i.duration,u=i.ease,s=i.offset,u=Array.isArray(u)?u:(t=this.values,n=u,t.map(function(){return n||et}).splice(0,t.length-1)),s=s||(r=this.values,e=r.length,r.map(function(t,n){return 0!==n?n/(e-1):0})),f=(o=a,s.map(function(t){return t*o}));this.interpolator=H(f,this.values,{ease:u})},vt.prototype.update=function(t){var n=this.options.duration;return this.isComplete=n<=t,this.interpolator(t)},vt.prototype.updateOptions=function(t){var n=t.from,r=void 0===n?0:n,e=t.to,o=void 0===e?1:e,i=t.ease,a=t.offset,u=t.duration,s=void 0===u?300:u;this.options={from:r,to:o,ease:i,offset:a,duration:s}},vt.prototype.flipTarget=function(){this.values.reverse(),this.createInterpolator()},vt.needsInterpolation=function(){return!1},vt.uniqueOptionKeys=new Set(["duration","ease"]),vt);function vt(t){this.isComplete=!1,this.updateOptions(t);var n=this.options,r=n.from,e=n.to;this.values=Array.isArray(e)?e:[r,e],this.createInterpolator()}var dt=(lt.prototype.flipTarget=function(){},lt.prototype.update=function(t){var n=this.options,r=n.timeConstant,e=n.restDelta,o=-this.amplitude*Math.exp(-t/r);return this.isComplete=!(e<o||o<-e),this.isComplete?this.target:this.target+o},lt.prototype.updateOptions=function(t){var n=void 0===t?{}:t,r=n.velocity,e=void 0===r?0:r,o=n.from,i=void 0===o?0:o,a=n.power,u=void 0===a?.8:a,s=n.timeConstant,f=void 0===s?350:s,p=n.restDelta,c=void 0===p?.5:p,v=n.modifyTarget;this.options={velocity:e,from:i,power:u,timeConstant:f,restDelta:c,modifyTarget:v}},lt.needsInterpolation=function(){return!1},lt.uniqueOptionKeys=new Set(["power","timeConstant","modifyTarget"]),lt);function lt(t){this.isComplete=!1,this.updateOptions(t);var n=this.options,r=n.power,e=n.velocity,o=n.modifyTarget,i=n.from,a=r*e,u=i+a,s=void 0===o?u:o(u);s!==u&&(a=s-i),this.target=s,this.amplitude=a}var ht=[ct,dt,n],mt={keyframes:ct,spring:n,decay:dt},yt=ht.length;var gt,Mt,bt=0,xt="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var n=Date.now(),r=Math.max(0,16.7-(n-bt));bt=n+r,setTimeout(function(){return t(bt)},r)};(Mt=gt=gt||{}).Read="read",Mt.Update="update",Mt.Render="render",Mt.PostRender="postRender",Mt.FixedUpdate="fixedUpdate";function Ot(t){return Ct=t}function wt(t){return qt[t].process(Dt)}var St=1/60*1e3,It=!0,Ct=!1,At=!1,Dt={delta:0,timestamp:0},Pt=[gt.Read,gt.Update,gt.Render,gt.PostRender],Tt=Pt.reduce(function(t,n){var e,i,a,u,s,o,f,p,c,v=(e=Ot,i=[],s=!(a=[]),o=u=0,f=new WeakSet,p=new WeakSet,c={cancel:function(t){var n=a.indexOf(t);f.add(t),-1!==n&&a.splice(n,1)},process:function(t){var n,r;if(s=!0,i=(n=[a,i])[0],(a=n[1]).length=0,u=i.length)for(o=0;o<u;o++)(r=i[o])(t),!0!==p.has(r)||f.has(r)||(c.schedule(r),e(!0));s=!1},schedule:function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var e=r&&s,o=e?i:a;f.delete(t),n&&p.add(t),-1===o.indexOf(t)&&(o.push(t),e&&(u=i.length))}});return t.sync[n]=function(t,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!1),Ct||jt(),v.schedule(t,n,r),t},t.cancelSync[n]=function(t){return v.cancel(t)},t.steps[n]=v,t},{steps:{},sync:{},cancelSync:{}}),qt=Tt.steps,Ft=Tt.sync,Rt=Tt.cancelSync,Ut=function(t){Ct=!1,Dt.delta=It?St:Math.max(Math.min(t-Dt.timestamp,40),1),It||(St=Dt.delta),Dt.timestamp=t,At=!0,Pt.forEach(wt),At=!1,Ct&&(It=!1,xt(Ut))},jt=function(){It=Ct=!0,At||xt(Ut)};function kt(t,n,r){return void 0===r&&(r=0),t-n-r}var Et=function(r){function t(t){var n=t.delta;return r(n)}return{start:function(){return Ft.update(t,!0,!0)},stop:function(){return Rt.update(t)}}};function zt(t){var i,a,n=t.from,r=t.to,e=t.autoplay,o=void 0===e||e,u=t.driver,s=void 0===u?Et:u,f=t.elapsed,p=void 0===f?0:f,c=t.repeat,v=void 0===c?0:c,d=t.repeatType,l=void 0===d?"loop":d,h=t.repeatDelay,m=void 0===h?0:h,y=t.onPlay,g=t.onStop,M=t.onComplete,b=t.onRepeat,x=t.onUpdate,O=function(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]]);return r}(t,["from","to","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),w=0,S=O.duration,I=!0,C=function(t){if(mt[t.type])return mt[t.type];for(var n in t)for(var r=0;r<yt;r++){var e=ht[r];if(e.uniqueOptionKeys.has(n))return e}return ct}(O);C.needsInterpolation(n,r)&&(a=H([0,100],[n,r],{clamp:!1}),n=0,r=100);var A=new C(q(q({},O),{from:n,to:r}));function D(){var t,n,r,e;w++,"reverse"===l?(t=p,n=S,void 0===(r=m)&&(r=0),void 0===(e=I=w%2==0)&&(e=!0),p=e?kt(n+-t,n,r):n-(t-n)+r):(p=kt(p,S,m),"mirror"===l&&A.flipTarget()),A.isComplete=!1,b&&b()}function P(t){I||(t=-t),p+=t;var n,r,e,o=A.update(Math.max(0,p));a&&(o=a(o)),null!==x&&void 0!==x&&x(o),(I?A.isComplete:p<=0)&&(0===w&&void 0===S&&(S=p),w<v?(n=p,r=S,e=m,(I?r+e<=n:n<=-e)&&D()):(i.stop(),M&&M()))}function T(){null!==y&&void 0!==y&&y(),(i=s(P)).start()}return o&&T(),{play:T,pause:function(){},resume:function(){},reverse:function(){},seek:function(){},stop:function(){null!==g&&void 0!==g&&g(),i.stop()}}}function Kt(t,n){return n?t*(1e3/n):0}function Nt(t){return 180*t/Math.PI}function Wt(t){return t}function Bt(i){return void 0===i&&(i=Wt),function(t,n,r){var e=n-r,o=-(0-t+1)*(0-i(Math.abs(e)));return e<=0?n+o:n-o}}function $t(t){return t*Math.PI/180}function _t(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")}function Gt(t){return _t(t)&&t.hasOwnProperty("z")}function Ht(t,n){return Math.abs(t-n)}var Lt=Bt(),Vt=Bt(Math.sqrt);function Jt(t,n){return void 0===n&&(n=2),n=Math.pow(10,n),Math.round(t*n)/n}function Qt(t,n,r,e){return void 0===e&&(e=0),Jt(t+r*(n-t)/Math.max(e,r))}function Xt(t,n){return 1-3*n+3*t}function Yt(t,n){return 3*n-6*t}var Zt=function(t,n,r){return((Xt(n,r)*t+Yt(n,r))*t+3*n)*t},tn=function(t,n,r){return 3*Xt(n,r)*t*t+2*Yt(n,r)*t+3*n},nn=1e-7,rn=10;var en=8;t.DecayAnimator=dt,t.KeyframesAnimator=ct,t.SpringAnimator=n,t.angle=function(t,n){return void 0===n&&(n=k),Nt(Math.atan2(n.y-t.y,n.x-t.x))},t.animate=zt,t.anticipate=ft,t.applyOffset=function(n,r){var e=!0;return void 0===r&&(r=n,e=!1),function(t){return e?t-n+r:(n=t,e=!0,r)}},t.attract=Lt,t.attractExpo=Vt,t.backIn=at,t.backInOut=st,t.backOut=ut,t.bounceIn=pt,t.bounceInOut=function(t){return t<.5?.5*(1-tt(1-2*t)):.5*tt(2*t-1)+.5},t.bounceOut=tt,t.circIn=Z,t.circInOut=it,t.circOut=ot,t.clamp=$,t.createAnticipate=X,t.createAttractor=Bt,t.createBackIn=Q,t.createExpoIn=J,t.cubicBezier=function(i,n,a,r){if(i===n&&a===r)return Y;for(var u=new Float32Array(11),t=0;t<11;++t)u[t]=Zt(.1*t,i,a);function e(t){for(var n=0,r=1;10!==r&&u[r]<=t;++r)n+=.1;var e=n+.1*((t-u[--r])/(u[r+1]-u[r])),o=tn(e,i,a);return.001<=o?function(t,n,r,e){for(var o=0;o<en;++o){var i=tn(n,r,e);if(0===i)return n;n-=(Zt(n,r,e)-t)/i}return n}(t,e,i,a):0===o?e:function(t,n,r,e,o){for(var i,a,u=0;0<(i=Zt(a=n+(r-n)/2,e,o)-t)?r=a:n=a,Math.abs(i)>nn&&++u<rn;);return a}(t,n,n+.1,i,a)}return function(t){return 0===t||1===t?t:Zt(e(t),n,r)}},t.degreesToRadians=$t,t.distance=function(t,n){if(w(t)&&w(n))return Ht(t,n);if(_t(t)&&_t(n)){var r=Ht(t.x,n.x),e=Ht(t.y,n.y),o=Gt(t)&&Gt(n)?Ht(t.z,n.z):0;return Math.sqrt(Math.pow(r,2)+Math.pow(e,2)+Math.pow(o,2))}},t.easeIn=nt,t.easeInOut=et,t.easeOut=rt,t.inertia=function(t){var n,r,e,o,i,a=t.from,u=void 0===a?0:a,s=t.velocity,f=void 0===s?0:s,p=t.min,c=t.max,v=t.power,d=void 0===v?.8:v,l=t.timeConstant,h=void 0===l?750:l,m=t.bounceStiffness,y=void 0===m?500:m,g=t.bounceDamping,M=void 0===g?10:g,b=t.restDelta,x=void 0===b?1:b,O=t.modifyTarget,w=t.driver,S=t.onUpdate,I=t.onComplete;function C(t){return void 0!==p&&t<p||void 0!==c&&c<t}function A(t){return void 0!==p&&(void 0===c||Math.abs(p-t)<Math.abs(c-t))?p:c}function D(r){null!==n&&void 0!==n&&n.stop(),n=zt(q(q({},r),{driver:w,onUpdate:function(t){var n;null!==S&&void 0!==S&&S(t),null!==(n=r.onUpdate)&&void 0!==n&&n.call(r,t)},onComplete:I}))}function P(t){D(q({type:"spring",stiffness:y,damping:M,restDelta:x},t))}return C(u)?P({from:u,velocity:f,to:A(u)}):(r=d*f+u,void 0!==O&&(r=O(r)),e=A(r),o=e===p?-1:1,D({type:"decay",from:u,velocity:f,timeConstant:h,power:d,restDelta:x,modifyTarget:O,onUpdate:C(r)?function(t){f=Kt(t-i,Dt.delta),0<e-(i=t)*o||P({from:i,to:e,velocity:f})}:void 0})),{stop:function(){return null===n||void 0===n?void 0:n.stop()}}},t.interpolate=H,t.isPoint=_t,t.isPoint3D=Gt,t.linear=Y,t.mirrorEasing=V,t.mix=s,t.mixColor=j,t.mixComplex=B,t.pipe=E,t.pointFromVector=function(t,n,r){return n=$t(n),{x:r*Math.cos(n)+t.x,y:r*Math.sin(n)+t.y}},t.progress=b,t.radiansToDegrees=Nt,t.reverseEasing=L,t.smooth=function(o){void 0===o&&(o=50);var i=0,a=0;return function(t){var n=Dt.timestamp,r=n!==a?n-a:0,e=r?Qt(i,t,r,o):i;return a=n,i=e}},t.smoothFrame=Qt,t.snap=function(o){if("number"==typeof o)return function(t){return Math.round(t/o)*o};var i=0,a=o.length;return function(t){var n=Math.abs(o[0]-t);for(i=1;i<a;i++){var r=o[i],e=Math.abs(r-t);if(0===e)return r;if(n<e)return o[i-1];if(i===a-1)return r;n=e}}},t.steps=function(e,o){return void 0===o&&(o="end"),function(t){var n=(t="end"===o?Math.min(t,.999):Math.max(t,.001))*e,r="end"===o?Math.floor(n):Math.ceil(n);return $(0,1,r/e)}},t.toDecimal=Jt,t.velocityPerFrame=function(t,n){return t/(1e3/n)},t.velocityPerSecond=Kt,t.wrap=function(t,n,r){var e=n-t;return((r-t)%e+e)%e+t},Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -70,3 +70,6 @@ 'use strict'; | ||
SpringAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 0.005 : _h, _j = _a.restDelta, restDelta = _j === void 0 ? 0.5 : _j; | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 0.005 : _h, restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) < 1 ? 0.01 : 0.5; | ||
} | ||
this.options = { | ||
@@ -73,0 +76,0 @@ from: from, |
{ | ||
"name": "popmotion", | ||
"version": "9.0.0-rc.3", | ||
"version": "9.0.0-rc.4", | ||
"description": "The animator's toolbox", | ||
@@ -5,0 +5,0 @@ "author": "Matt Perry", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1123115
6963