pixijs / guides

PixiJS User Guides
https://pixijs.io/guides/
MIT License
12 stars 36 forks source link

What is the unit of `delta` in Ticker #47

Open MqCreaple opened 1 year ago

MqCreaple commented 1 year ago

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.