Spec-Zone.ru › Dart 1

dart:html

Метод animate

  1. @Experimental()
  2. @SupportedBrowser(SupportedBrowser.CHROME, '36')
Animation animate(Iterable<Map<String, dynamic>> frames, [ timing ])

Создает новый объект 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, где записи map определяют CSS-эффекты анимации. Параметр timing может быть числом с плавающей точкой, представляющим количество миллисекунд для перехода, или объектом Map с полями, соответствующими полям объекта Timing.

Исходный код

@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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API