Skip to content

Frame Rate

wx.setPreferredFramesPerSecond

TIP

The API usage is as follows:wx.setPreferredFramesPerSecond(number fps)

  • Functional description: The rendering frame rate can be modified. The default rendering frame rate is 60 frames per second. After modification, the callback frequency of requestAnimationFrame will change.
  • Parameters and descriptions: number fps, Frame rate, valid range 1 - 60.

cancelAnimationFrame

TIP

The API usage is as follows: cancelAnimationFrame(number requestID)

  • Functional description: Cancel the animation frame request added to the schedule by requestAnimationFrame.
  • Parameters and descriptions: number requestID。

requestAnimationFrame

TIP

The API usage is as follows: number requestAnimationFrame(function callback)

  • Functional description: Executed at the next redraw.
  • Parameters and descriptions: function callback, Executed callback.
  • Return value: Request ID.