groupWithDuration method

Future<void> groupWithDuration(
  1. {Duration duration = const Duration(seconds: 1),
  2. @required List<double> fromValue,
  3. @required List<double> toValue,
  4. @required List<String> keyPath,
  5. int repeatCount = 0,
  6. int repeatMode = 0}
)

执行组合动画

keyPath为构造CABasicAnimation时的CABasicAnimation animationWithKeyPath:keyPath; 缩放为transform.scale, 透明度为opacity, 旋转为transform.rotation

fromValue, toValuekeyPath的长度必须相等

Implementation

Future<void> groupWithDuration({
  Duration duration = const Duration(seconds: 1),
  @required List<double> fromValue,
  @required List<double> toValue,
  @required List<String> keyPath,
  int repeatCount = 0,
  int repeatMode = 0,
}) async {
  assert(duration != null);
  assert(fromValue.length == toValue.length);
  assert(toValue.length == keyPath.length);
  await kMethodChannel.invokeMethod('UIView::groupWithDuration', {
    '__this__': this,
    'duration': duration.inMilliseconds / 1000,
    'fromValue': [for (final item in fromValue) item / 180 * pi],
    'toValue': [for (final item in fromValue) -item / 180 * pi],
    'keyPath': keyPath,
    'repeatCount': repeatCount,
    'repeatMode': repeatMode,
  });
}