animate method

  1. @override
Future<void> animate({
  1. required List<Phone1Led> channels,
  2. Duration? duration,
  3. int? intervalDuration,
  4. int? cycles,
  5. bool splitBuild = false,
})
override

Implementation

@override
Future<void> animate(
    {required List<Phone1Led> channels,
    Duration? duration,
    int? intervalDuration,
    int? cycles,
    bool splitBuild = false}) async {
  final builderId = await super.sdkInterface.builder();
  for (final channel in channels) {
    await super.sdkInterface.channel(id: builderId, channel: channel.value);
  }
  if (duration != null) {
    await super
        .sdkInterface
        .setPeriod(id: builderId, period: duration.inMilliseconds);
  }
  if (intervalDuration != null) {
    await super
        .sdkInterface
        .setInterval(id: builderId, interval: intervalDuration);
  }
  if (cycles != null) {
    await super.sdkInterface.setCycles(id: builderId, cycles: cycles);
  }
  await super.sdkInterface.build(id: builderId);
  if (duration == null && intervalDuration == null && cycles == null) {
    await super.sdkInterface.toggle(id: builderId);
  } else {
    await super.sdkInterface.animate(id: builderId);
  }
}