UNPKG

ui-humix-lib

Version:

A simple package for implementinghumix design components in react-based or node.js based projects.

41 lines (40 loc) 1.32 kB
<h1 x-data="{ startingAnimation: { opacity: 0 }, endingAnimation: { opacity: 1, stagger: 0.08, duration: 2.7, ease: 'power4.easeOut' }, addCNDScript: true, splitCharactersIntoSpans(element) { text = element.innerHTML; modifiedHTML = []; for (var i = 0; i < text.length; i++) { attributes = ''; if(text[i].trim()){ attributes = 'class=\'inline-block\''; } modifiedHTML.push('<span ' + attributes + '>' + text[i] + '</span>'); } element.innerHTML = modifiedHTML.join(''); }, addScriptToHead(url) { script = document.createElement('script'); script.src = url; document.head.appendChild(script); }, animateText() { $el.classList.remove('invisible'); gsap.fromTo($el.children, this.startingAnimation, this.endingAnimation); } }" x-init=" splitCharactersIntoSpans($el); if(addCNDScript){ addScriptToHead('https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.5/gsap.min.js'); } gsapInterval3 = setInterval(function(){ if(typeof gsap !== 'undefined'){ animateText(); clearInterval(gsapInterval3); } }, 5); " class="invisible block pb-0.5 overflow-hidden text-3xl font-bold custom-font" > Pines UI Library </h1>