lottie-react icon indicating copy to clipboard operation
lottie-react copied to clipboard

Interactive scroll animation stops

Open reptar25 opened this issue 4 years ago • 1 comments

Describe the bug The animation stops if the animation container position is 'sticky', but the animation only stops while the container is stuck.

To Reproduce Steps to reproduce the behavior:

export default function App() {
  const style = {
    height: "94vh",
    border: "3px solid black",
    borderRadius: "10px",
    position: "sticky",
    top: "5vh"
  };
  const options = {
    animationData: groovyWalkAnimation
  };

  const lottieObj = useLottie(options, style);
  const Animation = useLottieInteractivity({
    lottieObj,
    mode: "scroll",
    actions: [
      {
        visibility: [0.1, 0.9],
        type: "seek",
        frames: [0, 62]
      }
    ]
  });

  return (
    <>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <div style={{ height: "500vh", marginBottom: "1vh" }}>{Animation}</div>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
      <h1>lottie-react - Hook</h1>
    </>
  );
}

Expected behavior The animation should continue playing while the user is scrolling.

Additional context Code sandbox example

reptar25 avatar Jan 26 '22 02:01 reptar25

#85 it would help

lazarus2019 avatar Mar 13 '23 11:03 lazarus2019