Closed anirudhnykaa closed 2 years ago
Hi @anirudhnykaa you can currently get the animationData like this:
import React from 'react';
import { Player } from '@lottiefiles/react-lottie-player';
class App extends React.Component {
constructor(props) {
super(props);
this.state = { lottie: null }; // initialize your state
}
render() {
return (
<Player
lottieRef={instance => {
this.setState({ lottie: instance }); // the lottie instance is returned in the argument of this prop. set it to your local state
}}
autoplay={false}
loop={true}
controls={true}
src="https://assets3.lottiefiles.com/packages/lf20_XZ3pkn.json"
style={{ height: '300px', width: '300px' }}
></Player>
);
}
}
export default App;
Readme link: https://github.com/LottieFiles/lottie-react#get-lottie-instance
Overview
...
Motivation
...
Labels
Type: Enhancement
label to this issue.