Jump to content

Incorrect calculations related to FPS


Recommended Posts

I'm trying to make an object rotate constantly, with the speed of 3°/sec (360° in 2 minutes). The code should be pretty simple:

let object;
function setup() {
  object = new PIXI.Sprite(...);
  app.ticker.add(delta => renderLoop(delta));

function renderLoop(delta) {
  object.angle += 3 / 60;  

On every render, I increase object's angle by 3 divided by 60 (amount of times the renderLoop function will be called per second). However, when using stopwatch the rotation happens quicker than 3°/sec, and after playing with numbers I concluded that the approximate (if not fully correct) number is 144, and not 60. What can be the cause of this, and is there a better way to get that number instead of hardcoding it?

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...