Koroldev Posted December 20, 2016 Share Posted December 20, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2016 Share Posted December 20, 2016 Hello, do you mind sharing a sample repro using the Playground? Quote Link to comment Share on other sites More sharing options...
Koroldev Posted December 21, 2016 Author Share Posted December 21, 2016 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! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 21, 2016 Share Posted December 21, 2016 What are you looking for? Executing onANimationEnd even when you manually stop the animation? This is not how it should work for me. Quote Link to comment Share on other sites More sharing options...
Koroldev Posted December 21, 2016 Author Share Posted December 21, 2016 Conversely, when I stop the animation before it end, then function onANimationEnd is executing, but I need, if I stop the animation myself, then don't execute the function onANimationEnd. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 21, 2016 Share Posted December 21, 2016 How do you stop it by yourself? can you share a playground repro? Quote Link to comment Share on other sites More sharing options...
Koroldev Posted December 21, 2016 Author Share Posted December 21, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 22, 2016 Share Posted December 22, 2016 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) ? Koroldev 1 Quote Link to comment Share on other sites More sharing options...
Koroldev Posted December 23, 2016 Author Share Posted December 23, 2016 14 hours ago, Deltakosh said: Perhaps I can add a parameter like onAnimationEnd(stopped: boolean) ? Yes, would be cool ! But now I came up with a workaround, I save animateble in veriable and then before run animation again I write animateble.onAnimationEnd = null GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Koroldev Posted January 11, 2017 Author Share Posted January 11, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.