MasterK Posted September 2, 2016 Share Posted September 2, 2016 I think bjs need this. Scene.prototype._animate = function () { if (!this.animationsEnabled || this._activeAnimatables.length === 0) { return; } if (!this._animationStartDate) { if (this._pendingData.length > 0) { return; } this._animationStartDate = BABYLON.Tools.Now; } // Getting time var now = BABYLON.Tools.Now; var delay = (now - this._animationStartDate) * this.animationTimeScale; for (var index = 0; index < this._activeAnimatables.length; index++) { this._activeAnimatables[index]._animate(delay); } }; add a timeScale, default value is 1. so we can make animation speed *2 or * 0.5 by setting scene.timeScale = 2 or 0.5; @Deltakosh Is that ok? May be not only this one place to modify. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 2, 2016 Share Posted September 2, 2016 How is it different from the speedRatio parameter? http://doc.babylonjs.com/classes/2.3/Scene#beginanimation-target-from-to-loop-speedratio-onanimationend-animatable-rarr-animatable-classes-2-3-animatable- Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 5, 2016 Author Share Posted September 5, 2016 @Deltakosh I can't use this speedRatio to set everything. I want a overall control of animation speed. And more can't, i can't change speedRatio when i already began animation. Quote Link to comment Share on other sites More sharing options...
Diaco Posted September 5, 2016 Share Posted September 5, 2016 Hi Guys @MasterK I know Bjs has owned its animation engine , but I think that be good to try GSAP since it's really powerful & high-performance animation engine , easily can handle all your needs about animations. you will have benefits of timelines, and easily sequence tweens, use stagger Tweens, manage timescale, repeat, delays , ...etc . pls check this out : http://codepen.io/MAW/pen/66760a5b8426c1c871776d4f202d30c7?editors=0010 Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 5, 2016 Author Share Posted September 5, 2016 @Diaco wow, that's amazing. But i think gsap can't help me with skeleton animation... or other animation exported from 3dmax/unity. Quote Link to comment Share on other sites More sharing options...
Diaco Posted September 5, 2016 Share Posted September 5, 2016 @MasterK hmm , actually GSAP can animate any javascript object property , I don't know really about skeletons , maybe that be better to fork that codepen with a simple version of your code Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 5, 2016 Author Share Posted September 5, 2016 @Diaco http://www.babylonjs-playground.com/#11BH6Z#18 You can see this. And i'll go home now. See you tomorrow~. Quote Link to comment Share on other sites More sharing options...
Diaco Posted September 5, 2016 Share Posted September 5, 2016 I think it's possible , but my problem is I don't know what property is animating by this line : scene.beginAnimation(skeletons[0], 0, 100, true, 1.0); Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 6, 2016 Author Share Posted September 6, 2016 @Diaco It's in .babylon file. Lots of properties and changes. Anyway, i think add this timeScale is a simple way to solve some problem. If @Deltakosh won't handle this. I can only make it in my own project. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2016 Share Posted September 6, 2016 No no, don't take me wrong:) I tried to be sure that we do not already have it I'm fine with you adding this through a PR Quote Link to comment Share on other sites More sharing options...
adam Posted September 6, 2016 Share Posted September 6, 2016 @MasterK I set up a simple PG of animationScale slowly go up and down from 0 to 1. Is this the expected result? http://www.babylonjs-playground.com/#11BH6Z#82 Here animationScale going between .5 and 1: http://www.babylonjs-playground.com/#11BH6Z#83 When I first saw your request, I was thinking that you wanted a way to slow an animation down to a stop and slowly speed it up to full speed. Quote Link to comment Share on other sites More sharing options...
adam Posted September 6, 2016 Share Posted September 6, 2016 This is what I thought you wanted: http://www.babylonjs-playground.com/#11BH6Z#84 http://www.babylonjs-playground.com/#11BH6Z#85 Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 7, 2016 Author Share Posted September 7, 2016 11 hours ago, Deltakosh said: No no, don't take me wrong:) I tried to be sure that we do not already have it I'm fine with you adding this through a PR @DeltakoshI didn't say you wrong I just don't sure I can make good PR. I want you modify it because you can think better. 11 hours ago, adam said: @MasterK I set up a simple PG of animationScale slowly go up and down from 0 to 1. Is this the expected result? http://www.babylonjs-playground.com/#11BH6Z#82 Here animationScale going between .5 and 1: http://www.babylonjs-playground.com/#11BH6Z#83 When I first saw your request, I was thinking that you wanted a way to slow an animation down to a stop and slowly speed it up to full speed. @adamYes. That's it. though i can't see PG's animation... And i don't understand your first thought... Quote Link to comment Share on other sites More sharing options...
adam Posted September 7, 2016 Share Posted September 7, 2016 13 hours ago, MasterK said: And i don't understand your first thought... I think you will understand when you see the PGs I created. They should be working again now. Quote Link to comment Share on other sites More sharing options...
MasterK Posted September 8, 2016 Author Share Posted September 8, 2016 8 hours ago, adam said: I think you will understand when you see the PGs I created. They should be working again now. Yeah~~ I see now~~ Thank you for try~ I'll use your code~ 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.