Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 1014843004: Make Element.animate work in dart2js Chrome (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix comment indentation Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tests/html/element_animate_test.dart ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 38209ae33b6301370ed3aecf4ea85e2873b93b50..a41c6a6831db92c61746f14cf2f01f926dc5e362 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -779,6 +779,57 @@ $(ANNOTATIONS)$(NATIVESPEC)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS {
@deprecated
void leftView() {}
+$if DART2JS
+ /**
+ * Creates a new AnimationEffect object whose target element is the object
+ * on which the method is called, and calls the play() method of the
+ * AnimationTimeline object of the document timeline of the node document
+ * of the element, passing the newly created AnimationEffect as the argument
+ * to the method. Returns an AnimationPlayer for the effect.
+ *
+ * Examples
+ *
+ * var animation = elem.animate([{"opacity": 75}, {"opacity": 0}], 200);
+ *
+ * var animation = elem.animate([
+ * {"transform": "translate(100px, -100%)"},
+ * {"transform" : "translate(400px, 500px)"}
+ * ], 1500);
+ *
+ * The [frames] parameter is an Iterable<Map>, where the
+ * map entries specify CSS animation effects. The
+ * [timing] paramter can be a double, representing the number of milliseconds
+ * for the transition, or a Map with fields corresponding to those
+ * of the [Timing] object.
+ *
+ * This is not yet supported in Dartium.
+ **/
+// TODO(alanknight): Correct above comment once it works in Dartium.
+ @Experimental
+ @SupportedBrowser(SupportedBrowser.CHROME, '36')
+ AnimationPlayer animate(Iterable<Map<String, dynamic>> frames, [timing]) {
+ if (frames is! Iterable || !(frames.every((x) => x is Map))) {
+ throw new ArgumentError("The frames parameter should be a List of Maps "
+ "with frame information");
+ }
+ var convertedFrames = frames;
+ if (convertedFrames is Iterable) {
+ convertedFrames = frames.map(convertDartToNative_Dictionary).toList();
+ }
+ var convertedTiming = timing;
+ if (convertedTiming is Map) {
+ convertedTiming = convertDartToNative_Dictionary(convertedTiming);
+ }
+ return convertedTiming == null
+ ? _animate(convertedFrames)
+ : _animate(convertedFrames, convertedTiming);
+ }
+
+ @DomName('Element.animate')
+ @JSName('animate')
+ @Experimental() // untriaged
+ AnimationPlayer _animate(Object effect, [timing]) native;
+$endif
/**
* Called by the DOM whenever an attribute on this has been changed.
*/
« tests/html/element_animate_test.dart ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698