setTimeOut|setIntervalRelative to therequestAnimationFrameThe disadvantages of the

  • The former are generic methods and are not intended for animation
  • Even if a specific time is passed to the former, it cannot be processed at the specified time
  • Instead of thinking about the best time to draw the animation, the animation loop is called at some approximate time interval

Frame rate calculation

  • The time between the current frame and the previous frame is calculated as the number of frames played per secondfps
  • 1 (frame)/time difference (current time – last frame time) / 1000= >1000 / Time difference