import React, { useEffect, useRef } from 'react' import { createTimeline } from 'animejs' import SectionContainer from 'components/Layouts/SectionContainer' import { FifteenSVG, LW15ThemeSwitcher, LWSVG } from './lw15.components' const LW15Heading = () => { const videoRef = useRef(null) // Force play video useEffect(() => { if (!videoRef || !videoRef.current) return //open bug since 2017 that you cannot set muted in video element https://github.com/facebook/react/issues/10389 videoRef.current.defaultMuted = true videoRef.current.muted = true if (!!videoRef && !!videoRef.current) { const promise = videoRef.current.play() videoRef.current.play() if (promise !== undefined) { promise.then(() => { // Auto-play started videoRef.current?.play() }) } } }, [videoRef]) useEffect(() => { const tl = createTimeline({ defaults: { duration: 750 } }) tl.add('.lw15-logo', { opacity: [0, 1], scale: [0.9, 1], translateY: [20, 0], easing: 'outQuad', duration: 1500, }) .add('.lw15-galaxy', { width: ['0%', '100%'], flex: [0, 1], scale: [0.9, 1], opacity: [0, 1], easing: 'cubicBezier(0.25, 0.1, 0.25, 1)', duration: 500, }) .add( '.anim-last', { opacity: [0, 1], translateY: ['100%', 0], easing: 'cubicBezier(0.25, 0.1, 0.25, 1)', duration: 600, }, '+=300' ) .add( '.animate-line', { width: [0, '100%'], easing: 'inOutCubic', duration: 400, }, '-=600' ) .add( '.animate-cta', { opacity: [0, 1], translateY: [10, 0], easing: 'cubicBezier(.1,0,1,1)', duration: 1000, }, '-=100' ) const elements = document.querySelectorAll('[data-animate]') elements.forEach((element) => { if (element.getAttribute('data-animate-processed')) return element.setAttribute('data-animate-processed', 'true') const originalContent = element.innerHTML || '' element.classList.add('overflow-hidden') const span = document.createElement('span') span.innerHTML = originalContent span.style.display = 'inline-block' span.style.transform = 'translateY(100%)' span.style.transition = 'transform cubic-bezier(.25,.25,0,1)' element.innerHTML = '' element.appendChild(span) const delay = parseInt(element.getAttribute('data-animate-delay') || '100') const duration = parseInt(element.getAttribute('data-animate-duration') || '900') setTimeout(() => { setTimeout(() => { element.classList.add('opacity-100') span.style.transitionDuration = `${duration}ms` span.style.transform = 'translateY(0)' }, delay) // Delay after initial animejs animation }, 1500) }) }, []) return (
Five days of launches to supercharge your development.

Supabase Launch Week 15

) } export default LW15Heading