Jump to content

Animation timeScale


MasterK
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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...

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...