W3cubDocs

/Dart 2

animationFrame property

Future<num> animationFrame

Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame.

If you need to later cancel this animation, use requestAnimationFrame instead.

The Future completes to a timestamp that represents a floating point value of the number of milliseconds that have elapsed since the page started to load (which is also the timestamp at this call to animationFrame).

Note: The code that runs when the future completes should call animationFrame again for the animation to continue.

Implementation

Future<num> get animationFrame {
  var completer = new Completer<num>.sync();
  requestAnimationFrame((time) {
    completer.complete(time);
  });
  return completer.future;
}

© 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/animationFrame.html