Hi there,
I'd like to play only a part of frame of my animation but when I use the playSegments function, it plays all the frames.
I also checked the id and op value, and it seems correct (id = 0 & op = 111.000004521123)
Here's my code and my data.json file.
Does anyone have an idea ? Many thanks
var container = document.getElementById('container');
var animData = {
container: container,
renderer: 'svg',
loop: false,
prerender: false,
autoplay: false,
autoloadSegments: false,
path: directory_uri+'/js/data.json'
};
anim = bodymovin.loadAnimation(animData);
anim.playSegments([0,20],true);
try hooking to the "DOMLoaded" event before setting the new segment, or it will be overriden once the animation data loads.
That should solve it.
It solved it indeed !
Many thanks bodymovin master :)
That's 110% unintuitive! How many people ended on this page or on #398 ...
Nothing can be done to automaticaly preserve this setting once animation is loaded?
@bodymovin Follow up questions on this.
animationView.play(fromProgress: 0.25, toProgress: 0.5, withCompletion: nil) refThanks a million in advance.
@GreenMonkeySaveEarth
It solved it indeed !
Many thanks bodymovin master :)
Can you post your solution here if you don't mind? I'm having this same issue.
What am I doing wrong?
The entire animation timeline plays. I am trying to loop the the last segment only..
My code as follows:
lottie.loadAnimation({
container: document.getElementById('lottie'),
renderer: 'svg',
loop: true,
autoplay: true,
//autoloadSegments: false,
path: 'data.json'
})
var anim;
anim.addEventListener('DOMLoaded',function(){anim.playSegments([0,20],[21,89], true);})
Most helpful comment
That's 110% unintuitive! How many people ended on this page or on #398 ...
Nothing can be done to automaticaly preserve this setting once animation is loaded?