working animations

This commit is contained in:
2026-03-13 22:24:12 +01:00
parent 4293eef824
commit b5291caa6e
2 changed files with 2 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ import gsap from 'gsap'
const AnimateTextIn = ({children,animation="type",position}:{children:ReactNode,animation?:"type"|"slide",position:gsap.Position}) => { const AnimateTextIn = ({children,animation="type",position}:{children:ReactNode,animation?:"type"|"slide",position:gsap.Position}) => {
const el = useRef<HTMLDivElement>(null) const el = useRef<HTMLDivElement>(null)
const gsapContext = useGsapContext(); const gsapContext = useGsapContext();
useEffect(() => { useLayoutEffect(() => {
console.log("aniamte text with:",position) console.log("aniamte text with:",position)
const tl = gsap.timeline(); const tl = gsap.timeline();
const chars = new SplitText(el.current,{type:'chars'}) const chars = new SplitText(el.current,{type:'chars'})

View File

@@ -7,7 +7,7 @@ const AnimatedPageTitle = (
) => { ) => {
const el = useRef<HTMLHeadingElement>(null) const el = useRef<HTMLHeadingElement>(null)
const gsapContext = useGsapContext(); const gsapContext = useGsapContext();
useEffect(() => { useLayoutEffect(() => {
console.log("add animated title with:",position) console.log("add animated title with:",position)
const split = new SplitText(el.current, { type: "chars" }) const split = new SplitText(el.current, { type: "chars" })
gsapContext?.addAnimation(gsap.to(el.current, { opacity: 100 }),position) gsapContext?.addAnimation(gsap.to(el.current, { opacity: 100 }),position)