Controller topic
Controller
To control glitches, you will need to create an AnimatedGlitchController:
final controller = AnimatedGlitchController();
Controller has several key methods such as start, stop and reset.
final controller = AnimatedGlitchController();
controller.start();
controller.stop();
controller.reset();
You can specify (and mutate) optional values such as:
- frequency: Determines the interval at which glitches occur (mutable).
- chance: Determines the probability of a glitch appearing (mutable).
- level: Determines the extent to which
DistortionsandColorChannelsare shifted, based on the provided glitching level (mutable). - distortionShift: Determines the number of generated
Distortionsand the delays for appearing and disappearing (mutable). - colorChannelShift:
ColorChannelsare generated based on this. The number of "channel shifts" is equal to the length of the provided colors list. The value of delay specifies the duration after which the sequence of the ColorChannels will appear one by one (mutable). - autoStart: The controller will automatically start generating glitches upon creation.
final controller = AnimatedGlitchController(
frequency: const Duration(milliseconds: 500),
level: 2.2,
distortionShift: const DistortionShift(count: 20),
colorChannelShift: const ColorChannelShift(
colors: [
Colors.purple,
Colors.indigoAccent,
Colors.orange,
],
),
);
Output:
Classes
- AnimatedGlitchController Controller Known issues
- Controller to control the AnimatedGlitch widget.
- ColorChannelShift Controller
- Settings to shift color channels.
- DistortionShift Controller
-
The shifting settings to be used by
DistortionShifterto generateDistortion.