animationEnded event not working

Hey all,

I’ve been using the viewer api to build some custom animations but I can’t seem to get the “animationEnded” event to trigger.

api.addEventListener('animationEnded', function() {
    console.log('animation ended');

This doesn’t seem to trigger no matter what I do. Any thoughts?

Perhaps you can get inspiration from the documentation sample

You can replace the model ID in the code, click “Evaluate” and directly check on your model.
If it doesn’t work, it would help if you could “fork it” and post it here, as it would help a lot understanding the problem

Hmm, it does seem to be working when I swap in my model ID. It looks like the functions are structured differently than what I have. Would you be willing to take a look at the html?

On a related note, we can’t seem to get the api.translate working with this fbx for some reason. When you click the “collapse” button, you’ll see one of the cubes translate, then pop back into it’s original position. Thoughts?

Could you try with a newer version of the viewer API. latest is 1.5.1

For the translate, if you could please make a jsfiddle or codepen, just reading the HTML isn’t enough to reproduce the problem

Ok, looks like the updated API worked for the event issue.

For the translation problem, check out this pen:

Not sure why it’s not working in codepen (clicking “collapse” should translate the bottom object), but if you paste the code locally and run it, you’ll see the issue.

Hmm, it’s not working in either case for me…

On that model, here’s the list of nodes, and only those of type “MatrixTransform” are “translatable”:

Current codepn code target the node 418… which doesn’t exist.