animate method
Future<void>
animate({
- required List<
Phone2aLed> channels, - Duration? duration,
- int? intervalDuration,
- int? cycles,
override
Implementation
@override
Future<void> animate({
required List<Phone2aLed> channels,
Duration? duration,
int? intervalDuration,
int? cycles,
}) 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);
}
}