W3cubDocs

/Dart 2

requestAnimationFrame method

int requestAnimationFrame (FrameRequestCallback callback)

Called to draw an animation frame and then request the window to repaint after callback has finished (creating the animation).

Use this method only if you need to later call cancelAnimationFrame. If not, the preferred Dart idiom is to set animation frames by calling animationFrame, which returns a Future.

Returns a non-zero valued integer to represent the request id for this request. This value only needs to be saved if you intend to call cancelAnimationFrame so you can specify the particular animation to cancel.

Note: The supplied callback needs to call requestAnimationFrame again for the animation to continue.

Implementation

int requestAnimationFrame(FrameRequestCallback callback) {
  _ensureRequestAnimationFrame();
  return _requestAnimationFrame(_wrapZone(callback));
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-html/Window/requestAnimationFrame.html