working animations
This commit is contained in:
@@ -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'})
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user