Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

What is the unit of delta in Ticker #47

Open
MqCreaple opened this issue May 21, 2023 · 0 comments
Open

What is the unit of delta in Ticker #47

MqCreaple opened this issue May 21, 2023 · 0 comments

Comments

@MqCreaple
Copy link

In the example code given by the documentation:

  app.ticker.add((delta) => {
    // Add the time to our total elapsed time
    elapsed += delta;
    // Update the sprite's X position based on the cosine of our elapsed time.  We divide
    // by 50 to slow the animation down a bit...
    sprite.x = 100.0 + Math.cos(elapsed/50.0) * 100.0;
  });

I tried this code out, but it seems that the unit of delta in the code is neither seconds nor miliseconds. I measuerd the actual time between two ticks and the delta given by the function and their value seems to be 1 to 16 in ratio.

I think the documentation should clarify what unit the delta value is in, rather than using the vague term "time" to refer to the value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant