In Firefox 48 I intend to turn Element.animate on by default.
We have been developing the Web Animations API behind the
dom.animations-api.core.enabled preference and have introduced the
dom.animations-api.element-api.enabled preference for the subset of the
API that we intend to ship at this time.
Chrome have been shipping a very similar subset of the API starting with
Chrome 36[1] and have recently updated their implementation to match the
subset we plan to ship.[2]
WebKit[3] and Edge[4] both list this as "under consideration" although
some implementation work has begun in WebKit.[5]
This feature was previously discussed in this "intent to implement"
thread:
https://groups.google.com/d/topic/mozilla.dev.platform/3EXBgp26rJs/discussion
Bug to turn on by default:
https://bugzilla.mozilla.org/show_bug.cgi?id=1245000
Link to standard:
https://w3c.github.io/web-animations/#dom-animatable-animate
The subset of the API we intend to ship is described in the bug above, a
summary of which I have copied to the end of this mail. We do not intend
to ship the 'finished' promise at this time due to concern that this
should use a cancelable promise.[6]
Best regards,
Brian
[1]
https://www.chromestatus.com/features/4854343836631040,
https://www.chromestatus.com/features/5633748733263872
[2]
https://www.chromestatus.com/features/5650817352728576,
https://www.chromestatus.com/features/5663463749713920
[3]
https://webkit.org/status/#specification-web-animations
[4]
https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webanimationsjavascriptapi
[5]
https://lists.webkit.org/pipermail/webkit-dev/2015-November/027771.html
[6]
https://github.com/w3c/web-animations/issues/141
Proposed API subset:
enum AnimationPlayState { "idle", "pending", "running", "paused",
"finished" };
// 'Animation' will not be exposed on the global unless Element.animate
is called
interface Animation : EventTarget {
attribute DOMString id;
attribute double? startTime;
attribute double? currentTime;
attribute double playbackRate;
readonly attribute AnimationPlayState playState;
readonly attribute Promise<Animation> ready;
attribute EventHandler onfinish;
attribute EventHandler oncancel;
void cancel ();
void finish ();
void play ();
void pause ();
void reverse ();
};
enum FillMode {
"none",
"forwards",
"backwards",
"both",
"auto"
};
enum PlaybackDirection {
"normal",
"reverse",
"alternate",
"alternate-reverse"
};
dictionary AnimationEffectTimingProperties {
double delay = 0.0;
double endDelay = 0.0;
FillMode fill = "auto";
double iterationStart = 0.0;
unrestricted double iterations = 1.0;
(unrestricted double or DOMString) duration = "auto";
PlaybackDirection direction = "normal";
DOMString easing = "linear";
};
// These members are read but not implemented
dictionary KeyframeEffectOptions : AnimationEffectTimingProperties {
IterationCompositeOperation iterationComposite = "replace";
CompositeOperation composite = "replace";
DOMString spacing = "distribute";
};
dictionary KeyframeAnimationOptions : KeyframeEffectOptions {
DOMString id = "";
};
[NoInterfaceObject]
interface Animatable {
Animation animate(object? frames,
optional (unrestricted double or
KeyframeAnimationOptions)
options);
};
Element implements Animatable;