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

simple-animation-js

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-animation-js - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

dist/simpleAnimation.min.js
module.exports=function(b){var d=b.target,g=b.animations,m=void 0===b.defaultDuration?250:b.defaultDuration,n=void 0===b.defaultEasing?"linear":b.defaultEasing,c=void 0===b.DEBUG?!1:b.DEBUG;c&&console.info("DEBUG: simpleAnimation startet with config:",b);if(!(d instanceof window.Element||d instanceof window.HTMLDocument))throw Error("target undefinied or not HTMLElement: "+d);if(!Array.isArray(g))throw Error("animations undefinied or not Array: "+g);if("number"!==typeof m)throw Error("defaultDuration is not a number: "+
m);if("string"!==typeof n)throw Error("defaultEasing is not a string: "+n);if("boolean"!==typeof c)throw Error("DEBUG is not a boolean: "+c);var l=[],p=[];g.forEach(function(a,b){c&&console.info("DEBUG: process "+(b+1)+". animation with options:",a);var e=a.attribute,f=void 0===a.pctToScroll?!1:a.pctToScroll,h=void 0===a.duration?m:a.duration,g=void 0===a.easing?n:a.easing,k=a.animateTo;if("string"!==typeof e)throw Error("attribute undefinied or false type: "+e);if("boolean"!==typeof f)throw Error("pctToScroll is not a boolean: "+
f);if("number"!==typeof h)throw Error("duration is not a number: "+h);if("string"!==typeof g)throw Error("easing is not a string "+g);if(f){c&&console.info('DEBUG: "pctToScroll" is true, convert "'+k+'"');f=-1!==e.indexOf("height");var q=-1!==e.indexOf("width");if(!f&&!q)throw Error("Invalid direction",e);f=(f?d.scrollHeight:d.scrollWidth)*(parseFloat(k)/100)+"px";c&&console.info('DEBUG: converted "'+k+'" to "'+f+'" from attribute "'+e+'"');k=f}p.push({attribute:e,animateTo:k});h=e+" "+(h/1E3+"s")+
f);if("number"!==typeof h)throw Error("duration is not a number: "+h);if("string"!==typeof g)throw Error("easing is not a string "+g);if(f){c&&console.info('DEBUG: "pctToScroll" is true, convert "'+k+'"');f=-1!==e.indexOf("height");var q=-1!==e.indexOf("width");if(!f&&!q)throw Error("Invalid direction: "+e);f=(f?d.scrollHeight:d.scrollWidth)*(parseFloat(k)/100)+"px";c&&console.info('DEBUG: converted "'+k+'" to "'+f+'" from attribute "'+e+'"');k=f}p.push({attribute:e,animateTo:k});h=e+" "+(h/1E3+"s")+
" "+g;l.push(h);c&&console.info('DEBUG: animate "'+e+'" to "'+k+'" with transition: '+h)});b=l.join();c&&console.info("DEBUG: transitions to append: "+l.join());d.style.transition=b;c&&console.info("DEBUG: transitions now are: "+d.style.transition);p.forEach(function(a){c&&console.info("DEBUG: attribute to append: "+a.attribute+", value to append: "+a.animateTo);d.style[a.attribute]=a.animateTo;c&&console.info('DEBUG: attribute "'+a.attribute+'" now is: '+d.style[a.attribute])});if(""===d.style.transition)throw Error("Transitions invalid: "+
l);};
module.exports=function(a){var d=a.target,c=a.animations,f=void 0===a.defaultDuration?250:a.defaultDuration,g=void 0===a.defaultEasing?"linear":a.defaultEasing;a=void 0===a.DEBUG?!1:a.DEBUG;if(!(d instanceof window.Element||d instanceof window.HTMLDocument))throw Error("target undefinied or not HTMLElement: "+d);if(!Array.isArray(c))throw Error("animations undefinied or not Array: "+c);if("number"!==typeof f)throw Error("defaultDuration is not a number: "+f);if("string"!==typeof g)throw Error("defaultEasing is not a string: "+
g);if("boolean"!==typeof a)throw Error("DEBUG is not a boolean: "+a);var h=[],l=[];c.forEach(function(b){var a=b.attribute,e=void 0===b.pctToScroll?!1:b.pctToScroll,c=void 0===b.duration?f:b.duration,k=void 0===b.easing?g:b.easing;b=b.animateTo;if("string"!==typeof a)throw Error("attribute undefinied or false type: "+a);if("boolean"!==typeof e)throw Error("pctToScroll is not a boolean: "+e);if("number"!==typeof c)throw Error("duration is not a number: "+c);if("string"!==typeof k)throw Error("easing is not a string "+
k);if(e){e=b;b=-1!==a.indexOf("height");var m=-1!==a.indexOf("width");if(!b&&!m)throw Error("Invalid direction",a);e=(b?d.scrollHeight:d.scrollWidth)*(parseFloat(e)/100)+"px"}else e=b;l.push({attribute:a,animateTo:e});h.push(a+" "+(c/1E3+"s")+" "+k)});c=h.join();d.style.transition=c;l.forEach(function(a){d.style[a.attribute]=a.animateTo});if(""===d.style.transition)throw Error("Transitions invalid: "+h);};
k);if(e){e=b;b=-1!==a.indexOf("height");var m=-1!==a.indexOf("width");if(!b&&!m)throw Error("Invalid direction: "+a);e=(b?d.scrollHeight:d.scrollWidth)*(parseFloat(e)/100)+"px"}else e=b;l.push({attribute:a,animateTo:e});h.push(a+" "+(c/1E3+"s")+" "+k)});c=h.join();d.style.transition=c;l.forEach(function(a){d.style[a.attribute]=a.animateTo});if(""===d.style.transition)throw Error("Transitions invalid: "+h);};
{
"name": "simple-animation-js",
"version": "1.0.3",
"description": "Simple animation library which uses CSS transitions in the background and allows animating dimension percentages.",
"version": "1.0.4",
"description": "Simple animation library which uses CSS transitions in the background and allows animating dimension percentages with scrollWidth and scrollHeight.",
"browser": "dist/simpleAnimation.min.js",

@@ -10,3 +10,3 @@ "license": "MIT",

"release": {
"branch": "init"
"branch": "master"
},

@@ -13,0 +13,0 @@ "scripts": {

@@ -7,3 +7,2 @@ [![GitHub license](https://img.shields.io/github/license/Competec/simple-animation-js.svg)](https://github.com/Competec/simple-animation-js/blob/master/LICENSE)

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![JavaScript Style Guide](https://img.shields.io/badge/style%20guide-airbnb-brightgreen.svg)](https://github.com/airbnb/javascript)

@@ -10,0 +9,0 @@ # simple-animation-js

@@ -62,3 +62,3 @@ /** @define {boolean} */

if (!checkedHeight && !checkedWidth) {
throw new Error(`Invalid direction`, attribute);
throw new Error(`Invalid direction: ${attribute}`);
}

@@ -65,0 +65,0 @@ const value = checkedHeight ?

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