Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@motionone/animation

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@motionone/animation - npm Package Compare versions

Comparing version 10.13.2 to 10.14.0

8

dist/Animation.cjs.js

@@ -25,8 +25,6 @@ 'use strict';

if (utils.isEasingGenerator(easing$1)) {
const custom = easing$1.createAnimation(keyframes, () => "0", true);
const custom = easing$1.createAnimation(keyframes);
easing$1 = custom.easing;
if (custom.keyframes !== undefined)
keyframes = custom.keyframes;
if (custom.duration !== undefined)
initialDuration = custom.duration;
keyframes = custom.keyframes || keyframes;
initialDuration = custom.duration || initialDuration;
}

@@ -33,0 +31,0 @@ this.repeat = repeat;

@@ -21,8 +21,6 @@ import { noopReturn, defaults, isEasingGenerator, isEasingList, interpolate } from '@motionone/utils';

if (isEasingGenerator(easing)) {
const custom = easing.createAnimation(keyframes, () => "0", true);
const custom = easing.createAnimation(keyframes);
easing = custom.easing;
if (custom.keyframes !== undefined)
keyframes = custom.keyframes;
if (custom.duration !== undefined)
initialDuration = custom.duration;
keyframes = custom.keyframes || keyframes;
initialDuration = custom.duration || initialDuration;
}

@@ -29,0 +27,0 @@ this.repeat = repeat;

@@ -1,1 +0,1 @@

const t=(t,e,i)=>Math.min(Math.max(i,t),e),e=.3,i=0,s=0,a=0,n="ease",r=t=>"number"==typeof t,h=t=>Array.isArray(t)&&!r(t[0]);const o=(t,e,i)=>-i*t+i*e+t,u=t=>t,l=(t,e,i)=>e-t==0?1:(i-t)/(e-t);function c(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const a=l(0,e,s);t.push(o(i,1,a))}}function m(e,i=function(t){const e=[0];return c(e,t-1),e}(e.length),s=u){const a=e.length,n=a-i.length;return n>0&&c(i,n),n=>{let r=0;for(;r<a-2&&!(n<i[r+1]);r++);let u=t(0,1,l(i[r],i[r+1],n));const c=function(t,e){return h(t)?t[((t,e,i)=>{const s=e-t;return((i-t)%s+s)%s+t})(0,t.length,e)]:t}(s,r);return u=c(u),o(e[r],e[r+1],u)}}const p=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function d(t,e,i,s){if(t===e&&i===s)return u;const a=e=>function(t,e,i,s,a){let n,r,h=0;do{r=e+(i-e)/2,n=p(r,s,a)-t,n>0?i=r:e=r}while(Math.abs(n)>1e-7&&++h<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:p(a(t),e,s)}const f={ease:d(.25,.1,.25,1),"ease-in":d(.42,0,1,1),"ease-in-out":d(.42,0,.58,1),"ease-out":d(0,0,.58,1)},y=/\((.*?)\)/;function T(e){if("function"==typeof e)return e;var i;if(i=e,Array.isArray(i)&&r(i[0]))return d(...e);if(f[e])return f[e];if(e.startsWith("steps")){const i=y.exec(e);if(i){const e=i[1].split(",");return((e,i="end")=>s=>{const a=(s="end"===i?Math.min(s,.999):Math.max(s,.001))*e,n="end"===i?Math.floor(a):Math.ceil(a);return t(0,1,n/e)})(parseFloat(e[0]),e[1].trim())}}return u}class v{constructor(t,r=[0,1],{easing:o,duration:l=e,delay:c=i,endDelay:p=s,repeat:d=a,offset:f,direction:y="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=u,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),(t=>"object"==typeof t&&Boolean(t.createAnimation))(o=o||n)){const t=o.createAnimation(r,(()=>"0"),!0);o=t.easing,void 0!==t.keyframes&&(r=t.keyframes),void 0!==t.duration&&(l=t.duration)}this.repeat=d,this.easing=h(o)?u:T(o),this.updateDuration(l);const v=m(r,f,h(o)?o.map(T):u);this.tick=e=>{var i;let s=0;s=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=s,s/=1e3,s=Math.max(s-c,0),"finished"===this.playState&&void 0===this.pauseTime&&(s=this.totalDuration);const a=s/this.duration;let n=Math.floor(a),r=a%1;!r&&a>=1&&(r=1),1===r&&n--;const h=n%2;("reverse"===y||"alternate"===y&&h||"alternate-reverse"===y&&!h)&&(r=1-r);const o=s>=this.totalDuration?1:Math.min(r,1),u=v(this.easing(o));t(u);void 0===this.pauseTime&&("finished"===this.playState||s>=this.totalDuration+p)?(this.playState="finished",null===(i=this.resolve)||void 0===i||i.call(this,u)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}export{v as Animation,T as getEasingFunction};
const t=(t,e,i)=>Math.min(Math.max(i,t),e),e=.3,i=0,s=0,a=0,n="ease",r=t=>"number"==typeof t,h=t=>Array.isArray(t)&&!r(t[0]);const o=(t,e,i)=>-i*t+i*e+t,u=t=>t,l=(t,e,i)=>e-t==0?1:(i-t)/(e-t);function c(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const a=l(0,e,s);t.push(o(i,1,a))}}function m(e,i=function(t){const e=[0];return c(e,t-1),e}(e.length),s=u){const a=e.length,n=a-i.length;return n>0&&c(i,n),n=>{let r=0;for(;r<a-2&&!(n<i[r+1]);r++);let u=t(0,1,l(i[r],i[r+1],n));const c=function(t,e){return h(t)?t[((t,e,i)=>{const s=e-t;return((i-t)%s+s)%s+t})(0,t.length,e)]:t}(s,r);return u=c(u),o(e[r],e[r+1],u)}}const p=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function f(t,e,i,s){if(t===e&&i===s)return u;const a=e=>function(t,e,i,s,a){let n,r,h=0;do{r=e+(i-e)/2,n=p(r,s,a)-t,n>0?i=r:e=r}while(Math.abs(n)>1e-7&&++h<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:p(a(t),e,s)}const d={ease:f(.25,.1,.25,1),"ease-in":f(.42,0,1,1),"ease-in-out":f(.42,0,.58,1),"ease-out":f(0,0,.58,1)},y=/\((.*?)\)/;function T(e){if("function"==typeof e)return e;var i;if(i=e,Array.isArray(i)&&r(i[0]))return f(...e);if(d[e])return d[e];if(e.startsWith("steps")){const i=y.exec(e);if(i){const e=i[1].split(",");return((e,i="end")=>s=>{const a=(s="end"===i?Math.min(s,.999):Math.max(s,.001))*e,n="end"===i?Math.floor(a):Math.ceil(a);return t(0,1,n/e)})(parseFloat(e[0]),e[1].trim())}}return u}class v{constructor(t,r=[0,1],{easing:o,duration:l=e,delay:c=i,endDelay:p=s,repeat:f=a,offset:d,direction:y="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=u,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),(t=>"object"==typeof t&&Boolean(t.createAnimation))(o=o||n)){const t=o.createAnimation(r);o=t.easing,r=t.keyframes||r,l=t.duration||l}this.repeat=f,this.easing=h(o)?u:T(o),this.updateDuration(l);const v=m(r,d,h(o)?o.map(T):u);this.tick=e=>{var i;let s=0;s=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=s,s/=1e3,s=Math.max(s-c,0),"finished"===this.playState&&void 0===this.pauseTime&&(s=this.totalDuration);const a=s/this.duration;let n=Math.floor(a),r=a%1;!r&&a>=1&&(r=1),1===r&&n--;const h=n%2;("reverse"===y||"alternate"===y&&h||"alternate-reverse"===y&&!h)&&(r=1-r);const o=s>=this.totalDuration?1:Math.min(r,1),u=v(this.easing(o));t(u);void 0===this.pauseTime&&("finished"===this.playState||s>=this.totalDuration+p)?(this.playState="finished",null===(i=this.resolve)||void 0===i||i.call(this,u)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}export{v as Animation,T as getEasingFunction};

@@ -20,8 +20,6 @@ import { isEasingGenerator, isEasingList, defaults, noopReturn, interpolate as createInterpolate, } from "@motionone/utils";

if (isEasingGenerator(easing)) {
const custom = easing.createAnimation(keyframes, () => "0", true);
const custom = easing.createAnimation(keyframes);
easing = custom.easing;
if (custom.keyframes !== undefined)
keyframes = custom.keyframes;
if (custom.duration !== undefined)
initialDuration = custom.duration;
keyframes = custom.keyframes || keyframes;
initialDuration = custom.duration || initialDuration;
}

@@ -28,0 +26,0 @@ this.repeat = repeat;

{
"name": "@motionone/animation",
"version": "10.13.2",
"version": "10.14.0",
"description": "A semi-polyfill WAAPI animation.",

@@ -18,5 +18,5 @@ "license": "MIT",

"dependencies": {
"@motionone/easing": "^10.13.2",
"@motionone/types": "^10.13.2",
"@motionone/utils": "^10.13.2",
"@motionone/easing": "^10.14.0",
"@motionone/types": "^10.14.0",
"@motionone/utils": "^10.14.0",
"tslib": "^2.3.1"

@@ -30,3 +30,3 @@ },

],
"gitHead": "a33ab88400c8aac4a6755cda6f93c24563d9ddc5"
"gitHead": "4c59ce9e5539899722427bd00f857dc80f29fc09"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc