gradientify
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var Gradientify=/*#__PURE__*/function(){// In miliseconds | ||
"use strict";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var Gradientify=/*#__PURE__*/function(){// In miliseconds | ||
// setInterval type (yes, it's a number. lol) | ||
@@ -13,3 +13,3 @@ function a(b,c,d){_classCallCheck(this,a),this.target=b,this.gradients=c,this.fadeInterval=d,this.createGradientElements(),this.appendGradients(),this.startAnimation()}/* | ||
*uncomfortably complex computations grinning in the background* | ||
*/},{key:"startAnimation",value:function startAnimation(){var a=this;this.interval=setInterval(function(){var b=!0,c=!1,d=void 0;try{for(var e,f=a.gradientElements.entries()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=_slicedToArray(e.value,2),h=g[0],i=g[1],j=!0,k=!1,l=void 0;try{for(var m,n=i.entries()[Symbol.iterator]();!(j=(m=n.next()).done);j=!0){var o=_slicedToArray(m.value,2),p=o[0],q=o[1];if("1"===q.style.opacity){q.style.opacity="0";var r=a.gradientElements[h][++p%a.gradientElements.length];r.style.opacity="1";break}}}catch(a){k=!0,l=a}finally{try{j||null==n["return"]||n["return"]()}finally{if(k)throw l}}}}catch(a){c=!0,d=a}finally{try{b||null==f["return"]||f["return"]()}finally{if(c)throw d}}},this.fadeInterval)}// Fairly straightforward | ||
},{key:"stopAnimation",value:function stopAnimation(){clearInterval(this.interval)}}]),a}();exports["default"]=Gradientify; | ||
*/},{key:"startAnimation",value:function startAnimation(){var a=this;this.interval=setInterval(function(){var b=!0,c=!1,d=void 0;try{for(var e,f=a.gradientElements.entries()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=_slicedToArray(e.value,2),h=g[0],i=g[1],j=!0,k=!1,l=void 0;try{for(var m,n=i.entries()[Symbol.iterator]();!(j=(m=n.next()).done);j=!0){var o=_slicedToArray(m.value,2),p=o[0],q=o[1];if("1"===q.style.opacity){q.style.opacity="0";var r=a.gradientElements[h][++p%a.gradientElements[h].length];r.style.opacity="1";break}}}catch(a){k=!0,l=a}finally{try{j||null==n["return"]||n["return"]()}finally{if(k)throw l}}}}catch(a){c=!0,d=a}finally{try{b||null==f["return"]||f["return"]()}finally{if(c)throw d}}},this.fadeInterval)}// Fairly straightforward | ||
},{key:"stopAnimation",value:function stopAnimation(){clearInterval(this.interval)}}]),a}(); |
@@ -119,3 +119,3 @@ "use strict"; | ||
var _step2$value = _slicedToArray(_step2.value, 2), | ||
index = _step2$value[0], | ||
elementIndex = _step2$value[0], | ||
element = _step2$value[1]; | ||
@@ -125,3 +125,3 @@ | ||
element.style.opacity = '0'; | ||
var nextElement = _this3.gradientElements[targetIndex][++index % _this3.gradientElements.length]; | ||
var nextElement = _this3.gradientElements[targetIndex][++elementIndex % _this3.gradientElements[targetIndex].length]; | ||
nextElement.style.opacity = '1'; | ||
@@ -128,0 +128,0 @@ break; |
{ | ||
"name": "gradientify", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Create amazing, animated gradients with ease.", | ||
@@ -36,2 +36,3 @@ "main": "./dist/index.js", | ||
"@babel/preset-typescript": "^7.7.7", | ||
"babel-plugin-remove-import-export": "^1.1.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
@@ -38,0 +39,0 @@ "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", |
@@ -12,9 +12,12 @@ <img src="logo.png" height="60"> | ||
For wizards: | ||
``` | ||
npm i gradientify | ||
``` | ||
`npm i gradientify` | ||
For less-experienced wizards: | ||
```html | ||
<script src="https://gitcdn.link/cdn/karolsw3/gradientify/e921b5a569d07207ed8a41a79ed3adc547f2ff48/dist/gradientify.min.js"></script> | ||
``` | ||
For less-experienced wizards: | ||
(link to a CDN coming soon) | ||
## Usage | ||
@@ -30,3 +33,3 @@ | ||
], | ||
5000 // Interval in miliseconds | ||
3000 // Interval in miliseconds | ||
) | ||
@@ -33,0 +36,0 @@ ``` |
@@ -74,6 +74,6 @@ export default class Gradientify { | ||
for (let [targetIndex, gradientElements] of this.gradientElements.entries()) { | ||
for (let [index, element] of gradientElements.entries()) { | ||
for (let [elementIndex, element] of gradientElements.entries()) { | ||
if (element.style.opacity === '1') { | ||
element.style.opacity = '0' | ||
let nextElement = this.gradientElements[targetIndex][++index % this.gradientElements.length] | ||
let nextElement = this.gradientElements[targetIndex][++elementIndex % this.gradientElements[targetIndex].length] | ||
nextElement.style.opacity = '1' | ||
@@ -80,0 +80,0 @@ break |
Sorry, the diff of this file is not supported yet
112044
37
9