Метод animate
- @Experimental()
- @SupportedBrowser(SupportedBrowser.CHROME, '36')
Создает новый объект AnimationEffect, целевой элемент которого — объект, на котором вызывается метод, и вызывает метод play() объекта AnimationTimeline временной шкалы документа узла элемента, передавая новосозданный AnimationEffect в качестве аргумента методу. Возвращает Animation для эффекта.
Примеры
var animation = elem.animate([{"opacity": 75}, {"opacity": 0}], 200);
var animation = elem.animate([
{"transform": "translate(100px, -100%)"},
{"transform" : "translate(400px, 500px)"}
], 1500);
Параметр frames — это Iterable
Исходный код
@Experimental()
@SupportedBrowser(SupportedBrowser.CHROME, '36')
Animation 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;
if (frames is Iterable) {
convertedFrames = convertDartToNative_List(
frames.map(convertDartToNative_Dictionary).toList());
} else {
convertedFrames = frames;
}
var convertedTiming =
timing is Map ? convertDartToNative_Dictionary(timing) : timing;
return convertedTiming == null
? _animate(convertedFrames)
: _animate(convertedFrames, convertedTiming);
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-html/Element/animate.html