How to use the lottie-web.setDirection function in lottie-web

To help you get started, we’ve selected a few lottie-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redbadger / website-honestly / site / components / pride-heart / index.js View on Github external
componentDidUpdate(prevProps: Props) {
    const { direction, play } = this.props;
    if (direction !== prevProps.direction && play === true) {
      lottie.setDirection(direction === 'forward' ? 1 : -1);
      lottie.play();
    }
    if (play !== prevProps.play && play === true) {
      lottie.play();
    }
  }