startDayNightCycle method

void startDayNightCycle({
  1. Duration cycleDuration = const Duration(minutes: 1),
  2. DayNightCycleDirection? direction,
})

Starts the day/night cycle animation.

The cycleDuration parameter specifies how long one complete day/night cycle takes. Default is 1 minute for a full 24-hour simulation.

The direction parameter specifies whether the sun moves left-to-right or right-to-left. Default is DayNightCycleDirection.leftToRight.

Example usage:

controller.startDayNightCycle(
  cycleDuration: Duration(seconds: 30),
  direction: DayNightCycleDirection.rightToLeft,
);

Implementation

void startDayNightCycle({
  Duration cycleDuration = const Duration(minutes: 1),
  DayNightCycleDirection? direction,
}) {
  isDayNightCycleEnabled = true;
  if (direction != null) {
    dayNightCycleDirection = direction;
  }
  onStartDayNightCycleAnimation?.call(
    cycleDuration: cycleDuration,
    direction: dayNightCycleDirection,
  );
  notifyListeners();
}