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

segments not working?

Open ocundale opened this issue 5 years ago • 3 comments

I am having issues with the segments- for me, displaying a custom set of segments does not seem to do anything. My code:

import React from 'react';
import animation from './animation.json';
import Lottie from 'lottie-react-web';

const Opening = () => {
  const options = {
    loop: true,
    autoplay: true,
    prerender: true,
    animationData: animation,
  };

  return (
    <React.Fragment>
      <Lottie options={options} segments={[0, 8]} />
    </React.Fragment>
  );
};

export default Opening;

ocundale avatar Dec 01 '19 16:12 ocundale

I'm having the same issue.

Been looking into it and it might be implemented wrong in lottie-react-web Seems like the segments logic needs to be hooked onto DOMLoaded event of anim

I have not tested this, but it is mentioned in several issues from lottie-web

ex: https://github.com/airbnb/lottie-web/issues/581#issuecomment-408271807

Kegulf avatar Feb 14 '20 15:02 Kegulf

I never got segments to work in any of the existing lottie-web React wrappers, so I created a new, easier to use lottie React wrapper: react-lottie-player

mifi avatar Jul 12 '20 20:07 mifi

Has this problem been solved

coding-ice avatar Mar 30 '22 09:03 coding-ice