API Reference 0.3.24dart_web_toolkit_animationAnimationSchedulerImplWebkit

AnimationSchedulerImplWebkit class

Implementation using <code>webkitRequestAnimationFrame</code> and <code>webkitCancelRequestAnimationFrame</code>.

@see <a

 href="http://www.chromium.org/developers/web-platform-status#TOC-requestAnimationFrame">
 Chromium Web Platform Status</a>

@see <a href="http://webstuff.nfshost.com/anim-timing/Overview.html"> webkit

 draft spec</a>
class AnimationSchedulerImplWebkit extends AnimationSchedulerImpl {

 AnimationSchedulerImplWebkit();

 /**
  * Schedule an animation, letting the browser decide when to trigger the next
  * step in the animation.
  *
  * <p>
  * Using this method instead of a timeout is preferred because the browser is
  * in the best position to decide how frequently to trigger the callback for
  * an animation of the specified element. The browser can balance multiple
  * animations and trigger callbacks at the optimal rate for smooth
  * performance.
  * </p>
  *
  * @param callback the callback to fire
  * @return a handle to the requested animation frame
  * @param element the element being animated
  */
 AnimationHandle requestAnimationFrame(AnimationCallback callback, [dart_html.Element element = null]) {
   int requestId = requestAnimationFrameImpl(callback, element);
   return new AnimationHandleImplWebkit(requestId, this);
 }

 bool isNativelySupported() {
   return (dart_html.window.requestAnimationFrame != null &&
       dart_html.window.cancelAnimationFrame != null);
 }

 void cancelAnimationFrameImpl(int requestId) {
   dart_html.window.cancelAnimationFrame(requestId);
 }

 int requestAnimationFrameImpl(AnimationCallback callback, dart_html.Element element) {
   Function wrapper = (num highResTime) {
     callback.execute(new DateTime.now().millisecondsSinceEpoch);
   };
   return dart_html.window.requestAnimationFrame(wrapper);
 }
}

Extends

AnimationScheduler > AnimationSchedulerImpl > AnimationSchedulerImplWebkit

Constructors

new AnimationSchedulerImplWebkit() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
AnimationSchedulerImplWebkit();

Methods

void cancelAnimationFrameImpl(int requestId) #

void cancelAnimationFrameImpl(int requestId) {
 dart_html.window.cancelAnimationFrame(requestId);
}

bool isNativelySupported() #

Check if the implementation is natively supported.

@return true if natively supported, false if not

docs inherited from AnimationSchedulerImpl
bool isNativelySupported() {
 return (dart_html.window.requestAnimationFrame != null &&
     dart_html.window.cancelAnimationFrame != null);
}

AnimationHandle requestAnimationFrame(AnimationCallback callback, [Element element = null]) #

Schedule an animation, letting the browser decide when to trigger the next step in the animation.

Using this method instead of a timeout is preferred because the browser is in the best position to decide how frequently to trigger the callback for an animation of the specified element. The browser can balance multiple animations and trigger callbacks at the optimal rate for smooth performance.

@param callback the callback to fire @return a handle to the requested animation frame @param element the element being animated

AnimationHandle requestAnimationFrame(AnimationCallback callback, [dart_html.Element element = null]) {
 int requestId = requestAnimationFrameImpl(callback, element);
 return new AnimationHandleImplWebkit(requestId, this);
}

int requestAnimationFrameImpl(AnimationCallback callback, Element element) #

int requestAnimationFrameImpl(AnimationCallback callback, dart_html.Element element) {
 Function wrapper = (num highResTime) {
   callback.execute(new DateTime.now().millisecondsSinceEpoch);
 };
 return dart_html.window.requestAnimationFrame(wrapper);
}