playSegments runs whole animation
See original GitHub issueI am implementing ng-lottie in my angular 4 app. I am trying to play a segment when the animation is created. But on creation, it plays the whole animation at first then loop through the segment. Here is my code -
//Lottie configuration in component.
this.lottieConfig = {
renderer: 'svg',
loop: true,
prerender: false,
autoplay: false,
autoloadSegments: false,
path: './assets/content/data_3.json'
};
//HTML code
<lottie-animation-view [options]="lottieConfig" (animCreated)="handleAnimation($event)" (click)="onAnimationClick()"></lottie-animation-view>
//Handle animation function on animation create
handleAnimation(anim: any) {
this.anim = anim;
this.anim.playSegments([[0,479]],true);
}
Although I am able to find a solution by adding timeout in handleAnimation function. But I do not know if this is the correct way to solve this issue.
//Handle animation function code with timeout
handleAnimation(anim: any) {
this.anim = anim;
setTimeout(() => {
this.anim.playSegments([[0,479]],true);
} , 1);
}
Just think that it has something to do with this issue https://github.com/bodymovin/bodymovin/issues/398
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
The `playSegments()` plays the whole animation before ...
The playSegments() plays the whole animation before playing the segment ... it lets the current segment play and then runs the enqueued one?...
Read more >android: play segment of Lottie animation - Stack Overflow
It sets the minimum frame that the animation will start from when playing or looping. lottie_toggle.setMinFrame(minFrame);. It sets the minimum ...
Read more >[Lottie Animations] playSegments - OutSystems
There is no solution for my question in that post, thats why I create a new post. Playsegment is used when you want...
Read more >EASIEST Way To Play Parts Of Lottie Animations - YouTube
Named markers are a great way to easily identify and play different parts of your Lottie animations, saving you from having to find...
Read more >How To Play Segments Of Lottie Animations - YouTube
Segments of Lottie animations can be played using the playSegments function of Lottie-web. You can play different segments of your animation ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just made the config
autoloadSegments: false
work in v0.2.1Can you please try it, and give me some feedback? Thanks!
Also I cannot get the proper syntax for playSegments(). Console is telling me I need ‘:’ instead of a comma?