Chromium Code Reviews| 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..a8f629cda35fb40617d6c1c32ba5dbbbf3f1abab 100644 |
| --- a/tools/dom/templates/html/impl/impl_Element.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate |
| @@ -779,6 +779,53 @@ $(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); |
| + * |
|
sra1
2015/03/18 00:20:47
1. Indent +4
2. Missing ]
3. Inconsistent space on
Alan Knight
2015/03/18 20:09:20
1. dartfmt says only +2
2. Done
3. Done
sra1
2015/03/19 02:20:46
Markdown in this doc comment starts recognizing a
Alan Knight
2015/03/23 18:57:52
Ah, I misunderstood. Done.
|
| + * var animation = elem.animate([ |
| + * {"transform": "translate(100px, -100%)"}, |
| + * {"transform" : "translate(400px, 500px)"} |
| + * ], 1500); |
| + * |
| + * The [frames] parameter is a List<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(List<Map<String, dynamic>> frames, [timing]) { |
| + // If frames is an AnimationEffect, leave it alone? |
|
sra1
2015/03/18 00:20:47
Be more defensive. Fail if not a list or Animation
Alan Knight
2015/03/18 20:09:20
Oops. It must de facto be a List, that comment was
|
| + var convertedFrames = frames; |
| + if (convertedFrames is List) { |
| + convertedFrames = frames.map( |
| + (x) => convertDartToNative_Dictionary(x)).toList(); |
|
sra1
2015/03/18 00:20:47
frames.map(convertDartToNative_Dictionary).toList(
Alan Knight
2015/03/18 20:09:20
Oh yeah. Nice. Done.
|
| + } |
| + var convertedTiming = timing; |
| + if (convertedTiming is Map) { |
| + convertedTiming = convertDartToNative_Dictionary(convertedTiming); |
| + } |
| + return _animate(convertedFrames, convertedTiming); |
|
sra1
2015/03/18 00:20:47
What if timing is null, does it work for both is n
Alan Knight
2015/03/18 20:09:20
It seems to make no difference between 0, null, an
|
| + } |
| + |
| + @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. |
| */ |