diff --git a/doc/index.html b/doc/index.html index a10f1f4..bd27ff6 100644 --- a/doc/index.html +++ b/doc/index.html @@ -153,7 +153,7 @@

License

Apache 2.0

diff --git a/doc/main.js.html b/doc/main.js.html index 7b5542c..2c8f532 100644 --- a/doc/main.js.html +++ b/doc/main.js.html @@ -113,7 +113,7 @@

main.js

diff --git a/doc/module-floating.html b/doc/module-floating.html index d4c0153..3680292 100644 --- a/doc/module-floating.html +++ b/doc/module-floating.html @@ -466,7 +466,7 @@
Parameters:
diff --git a/floating.js b/floating.js index 45dac7a..154bb39 100644 --- a/floating.js +++ b/floating.js @@ -1,85 +1 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.floating = factory()); -}(this, (function () { 'use strict'; - -/** - * Float a number of things up on a page (hearts, flowers, 👌 ...) - *
- * You give the options in an object. - * - * @module floating - * @param {string} [options.content='👌'] - * the character or string to float - * @param {number} [options.number=1] - * the number of items - * @param {number} [options.duration=10] - * the amount of seconds it takes to float up - * @param {number|string} [options.repeat='infinite'] - * the number of times you want the animation to repeat - * @param {string} [options.direction='normal'] - * The - * animation-direction of the main animation - * @param {number|array} [options.sizes=2] - * The size (in em) of each element. Giving two values in an array will - * give a random size between those values. - */ -function floating() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$content = _ref.content, - content = _ref$content === undefined ? '👌' : _ref$content, - _ref$number = _ref.number, - number = _ref$number === undefined ? 1 : _ref$number, - _ref$duration = _ref.duration, - duration = _ref$duration === undefined ? 10 : _ref$duration, - _ref$repeat = _ref.repeat, - repeat = _ref$repeat === undefined ? 'infinite' : _ref$repeat, - _ref$direction = _ref.direction, - direction = _ref$direction === undefined ? 'normal' : _ref$direction, - _ref$size = _ref.size, - size = _ref$size === undefined ? 2 : _ref$size; - - var style = document.createElement('style'); - style.id = 'floating-style'; - - if (!document.getElementById('floating-style')) { - document.head.appendChild(style); - } - - document.getElementById('floating-style').innerHTML = '.float-container {width:100vw;height:100vh;overflow:hidden;position:absolute;top:0;left:0;pointer-events:none;}.float-container div * {width:1em;height:1em;}@keyframes float{0%{bottom:-100%;}100%{bottom:100%;}}@keyframes move{0%,100%{left:-3em;}50%{left:3em;}}'; - - var container = document.createElement('div'); - - container.className = 'float-container'; - - var _loop = function _loop(i) { - var floater = document.createElement('div'); - floater.innerHTML = content; - var _size = size; - - if (size instanceof Array) { - _size = Math.floor(Math.random() * (size[1] - size[0] + 1)) + size[0]; - } - - floater.style.cssText = 'position:absolute;font-size:' + _size + 'em;left:0;bottom:-100%;animation:float ' + duration + 's ease-in ' + i * Math.random() + 's ' + repeat + ' ' + direction + ',move 3s ease-in-out ' + i * Math.random() + 's infinite;transform:translateX(' + Math.random() * 100 + 'vw);'; - - floater.addEventListener('animationend', function (e) { - if (e.animationName === 'float') { - container.removeChild(floater); - } - }); - - container.appendChild(floater); - }; - - for (var i = 0; i < number; i++) { - _loop(i); - } - - document.body.appendChild(container); -} - -return floating; - -}))); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.floating=t()}(this,function(){"use strict";function e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.content,n=void 0===t?"👌":t,o=e.number,i=void 0===o?1:o,a=e.duration,d=void 0===a?10:a,m=e.repeat,r=void 0===m?"infinite":m,l=e.direction,f=void 0===l?"normal":l,s=e.size,c=void 0===s?2:s,v=document.createElement("style");v.id="floating-style",document.getElementById("floating-style")||document.head.appendChild(v),document.getElementById("floating-style").innerHTML=".float-container {width:100vw;height:100vh;overflow:hidden;position:absolute;top:0;left:0;pointer-events:none;}.float-container div * {width:1em;height:1em;}@keyframes float{0%{bottom:-100%;}100%{bottom:100%;}}@keyframes move{0%,100%{left:-3em;}50%{left:3em;}}";var u=document.createElement("div");u.className="float-container";for(var h=function(e){var t=document.createElement("div");t.innerHTML=n;var o=c;c instanceof Array&&(o=Math.floor(Math.random()*(c[1]-c[0]+1))+c[0]),t.style.cssText="position:absolute;font-size:"+o+"em;left:0;bottom:-100%;animation:float "+d+"s ease-in "+e*Math.random()+"s "+r+" "+f+",move 3s ease-in-out "+e*Math.random()+"s infinite;transform:translateX("+100*Math.random()+"vw);",t.addEventListener("animationend",function(e){"float"===e.animationName&&u.removeChild(t)}),u.appendChild(t)},p=0;p