Framer Lottie ScrollTrigger Viewport Problem Solved

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 6

  • @jacekkrugy9411
    @jacekkrugy9411 5 หลายเดือนก่อน +1

    Literally, what you did... it made my day

  • @Ankur.Sangwan
    @Ankur.Sangwan 11 หลายเดือนก่อน +1

    thankyou, it was very helpful

  • @viralandroid205
    @viralandroid205 6 หลายเดือนก่อน

    Thanks, Man, Its Really Helpful...

  • @ShamsNahid
    @ShamsNahid  ปีที่แล้ว +1

    import type { ComponentType } from "react"
    import { createRef, useEffect, useRef } from "react"
    import { useScroll, useTransform, useSpring } from "framer-motion"
    // Scrub through a Lottie animation by scrolling while it is in view
    export function withScrolledProgressInView(Component): ComponentType {
    return (props: any) => {
    const ref = useRef(null)
    const { scrollYProgress } = useScroll({
    target: ref,
    offset: ["end", "start"],
    layoutEffect: false, // fix required for sticky elements
    })
    const animationSpeed = useSpring(scrollYProgress, {
    stiffness: 20,
    damping: 20,
    //mass: 3.7,
    })
    return (



    )
    }
    }
    // const animationProgress = useTransform(scrollYProgress, {
    // easing: "easeInOut",
    // outputRange: [0, 1],
    // })

  • @jungsunyoo7852
    @jungsunyoo7852 11 หลายเดือนก่อน +1

    so gooood~~~
    I have a question.
    Is it possible to control play, pause, stop (reset), gotoAndPlay (frame number), and gotoAndStop (frame number) with a specific button?

    • @ShamsNahid
      @ShamsNahid  11 หลายเดือนก่อน

      yes, you have to add those functions on code override section.