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.
In the example code given by the documentation:
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 thedelta
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.