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
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
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); }