-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loop animation property #21
Comments
Great idea. |
Nice, works great 馃憤 |
@eneskaya do you know how I do a loop? I tried to add this
|
@femontanha It only works with the imperative API, so be sure NOT to use ...
componentDidMount() {
this.animation.start();
}
render() {
<Animation
source={json}
style={{width: 100, height: 100}}
ref={(animation) => this.animation = animation} // the ref to the LottieAnimation component
loop
/>
} |
@eneskaya can you please post the whole snippet. I cant seem to figure out how you |
@xeroxoid what do you mean, how I initialized the animation? (sorry for late reply) |
Echoing @xeroxoid. I get a reference error when I use the imperative API.
Turns out the Animation is not initialized when the componentDidMount is run so I used a timer. Definitely open to suggestions.
|
This seems to work even better |
Thoughts on allowing loop to take a number as an option? For cases where you want the animation to loop some amount of times less than infinity. |
@agrosner is working but need to add a check (plz don鈥檛 ask me why ^^) : <Animation
loop
source={source}
ref={animation => {
if (animation) animation.play()
}}
/>
|
First of all: 馃憤 馃憤 馃憤
Would be nice to have a convenient way of starting looped animations! So not only calling
play()
but alsoloop()
The text was updated successfully, but these errors were encountered: