-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.min.js
More file actions
1 lines (1 loc) · 1.49 KB
/
main.min.js
File metadata and controls
1 lines (1 loc) · 1.49 KB
1
exports.wavy=function(t,n,e){const o={color:"black",fontSize:"1rem",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",transform:"scale(1.5)"};function a(t){return void 0!==e&&0!==Object.keys(e).length&&void 0!==e[t]?e[t]:o[t]}t.style=` \n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content; \n -webkit-transform: ${a("transform")};\n transform: ${a("transform")};\n font-family: ${a("fontFamily")};\n font-size: ${a("fontSize")};\n `;const r=n.words;let i=1,s=r.map((t=>t.split(""))).map((t=>t.map((t=>" "===t?"<span> </span>":`<span>${t}</span>`)).join(""))),l=t;l.innerHTML=s[0],function n(){l.childNodes.forEach((t=>{t.style=`\n display: inline-block;\n opacity: 0;\n transform: translateY(10px);\n color: ${a("color")};\n `}));let e=t.childNodes;for(let t=0;t<e.length;t++){let o=e.length;l.animate([{transform:`${a("transform")}`},{transform:`scale(${Number(1)})`}],{delay:`${Number(o/3*100)}`,duration:400,iterations:1,easing:"ease-in-out",fill:"both"}),e[t].animate([{opacity:0,transform:`translateY(${Number(10)}px)`},{opacity:1,transform:`translateY(${Number(0)}px)`}],{delay:(t+2)/2*100,duration:10*(t+.1),easing:"ease-out",iterations:1,fill:"forwards"});t==e.length-1&&setTimeout((()=>{e.forEach((t=>{t.style="opacity: 0;"}));for(let t=0;t<r.length;t++)if(i==t+1){l.innerHTML=s[t];break}n()}),2e3)}i==r.length?i=1:i++}()};