scroll triggers

This commit is contained in:
2026-03-14 18:35:04 +01:00
parent b5291caa6e
commit 57978d81e1
6 changed files with 102 additions and 66 deletions

View File

@@ -7,14 +7,14 @@ const AnimatedPageTitle = (
) => {
const el = useRef<HTMLHeadingElement>(null)
const gsapContext = useGsapContext();
useLayoutEffect(() => {
useEffect(() => {
console.log("add animated title with:",position)
const split = new SplitText(el.current, { type: "chars" })
gsapContext?.addAnimation(gsap.to(el.current, { opacity: 100 }),position)
gsapContext?.addAnimation(gsap.from(split.chars, {
stagger: 0.05, rotate: -90, opacity: 0, x: -10
}),'>')
})
},[])
return (
<h1 className="text-4xl opacity-0 font-bold text-balance w-full" ref={el}> {text} </h1>
)