Jump to content

OnAnimEnd in version 2.5


Koroldev
 Share

Recommended Posts

Hi guys, I'm not sure that is a bug, but I don't know where I can ask it, on github I did not find the section with issues, sorry 

In previously version of the babylon, it seems it was version 2.5 - alpha, I used function beginAnimation and parameter OnAnimEnd.

I have an animation of the fire from gun (30 frames). Always when I run the animation of the fire, I passed a parameter OnAnimEnd = function() { console.log("anim end") }, then I very fast clicked the button for the fire and all parameters functions OnAnimEnd called at different times one by one as it should be.

But in new version of babylon - 2.5. I don't changed my code, just updated version of babylon. All functions OnAnimEnd calls at the same time. If I click fire and animation started, then I do not wait for anomation end and clicked fire again and immediately I get console.log("anim end") twice, and after that second animation of fire yet playing and when this animation will end, function OnAnimEnd already been in past. I hope my English not very difficult to anderstand :)

Link to comment
Share on other sites

Deltakosh, I solved this problem, just somthing works different with the animation in new version of the babylon and I rewrite my code. But I had one more question, if I started animation and set the parameter onAnimEnd, but sometimes I need stop the animation, so that this function fails to execute. How can I do this? Thank!

Link to comment
Share on other sites

40 minutes ago, Deltakosh said:

How do you stop it by yourself? can you share a playground repro?

My project have about two thousand lines and many differents js files it is difficult to share this :)

I have an animation fire from gun and if I click the mouse button, then plays animation of a fire from the gun, and if this animation do not over and I click mouse button again, then plays animation of a fire from the gun again from the first frame and calls  onAnimationEnd. But I need, if my animation did not finish until the end and started egain, then dont call the function onAnimationEnd. Because function onAnimationEnd calls in all situations whether animations is played to the end or did not played to the end and started again. I know, the answer is somewhere near :)

Link to comment
Share on other sites

Ok understood

So far animationEnd is also called when you call stop():

https://github.com/BabylonJS/Babylon.js/blob/master/src/Animations/babylon.animatable.ts#L120

or when animationReach end:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Animations/babylon.animatable.ts#L162

Perhaps I can add a parameter like onAnimationEnd(stopped: boolean) ?

Link to comment
Share on other sites

  • 3 weeks later...
On 20.12.2016 at 7:13 PM, Deltakosh said:

Hello, do you mind sharing a sample repro using the Playground?

Deltakosh, Hello again! I did not solve this problem but I knew something new about this problem and attach an example in this topic with this problem in the babylon 2.5, but if you run example in the babylon 2.4, then all works fine

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...