animatable-component: Can't run two animations at once
I have to animations I try to run, and both start according to events, but only one finishes. I’m not getting any errors back.
if(self.animatePlayerTo != null)
{
var animatePlayerTo = document.getElementById("animate"+self.animatePlayerTo);
console.log(animatePlayerTo);
animatePlayerTo.addEventListener("start", function(event) {
console.log('ANIMATION START', event)
});
animatePlayerTo.addEventListener("finish", function(event) {
console.log('ANIMATION FINISH', event)
});
await animatePlayerTo.play();
//self.animatePlayerTo = null;
}
if(self.animatePlayerFrom != null)
{
var animatePlayerFrom = document.getElementById("animate"+self.animatePlayerFrom);
console.log(animatePlayerFrom);
animatePlayerFrom.addEventListener("start", function(event2) {
console.log('ANIMATION START', event2)
});
animatePlayerFrom.addEventListener("finish", function(event2) {
console.log('ANIMATION FINISH', event2)
});
await animatePlayerFrom.play();
//self.animatePlayerFrom = null;
}
Console proof… https://imgur.com/hOjGct7
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 19 (11 by maintainers)
if I put autoPlay in the HTML, it works fine. I’m pretty much using the same code as posted above. I want to make it work from the programming, so I want it to be there, but turn autoPlay on. I have the programming exactly as above also, and it fires off (the correct amount of times now, on the latest version) and it looks like it starts and stops from my subscriptions to the events, but I don’t see any movement, etc.
still not working for me. I think it’s kicking off once for each which is good, but there is no animation.
I even made sure it’s a div that is ‘display: block’ and that is wrapped around an img.
One more thing, Should this be able to work with more than one element inside? Like a div with a row of columns etc?
can I put that right in my page in ionic?
yeah I only put the events, so I could see when each started and stopped. Both started, but only the one that worked finished.
Yeah, very odd… I’m checking right now
I am, but the events aren’t really the problem. I’m wanting to NOT use autoPlay, and fire it off myself from within the program. I can do it with the .play() on the second one, but it’s like the first doesn’t happen. Even if I put await both of them.