ShakeConfig class

Configuration for a shake animation.

ShakeConfig defines how the shake animation behaves, including:

Example:

final config = ShakeConfig(
  offsets: [0, -12, 12, -8, 8, 0],
  weights: [1, 2, 2, 2, 1],
  axis: ShakeAxis.horizontal,
  duration: const Duration(milliseconds: 600),
);

Notes:

  • offsets must contain at least 2 values (start and end).
  • weights length must be offsets.length - 1.

Constructors

ShakeConfig({required List<double> offsets, required List<double> weights, Duration duration = const Duration(milliseconds: 600), Curve curve = Curves.easeOut, ShakeAxis axis = ShakeAxis.horizontal})
Public const constructor.
const
ShakeConfig.create({required List<double> offsets, required List<double> weights, Duration duration = const Duration(milliseconds: 600), Curve curve = Curves.easeOut, ShakeAxis axis = ShakeAxis.horizontal})
Recommended constructor with validation.
factory

Properties

axis ShakeAxis
The shake axis direction.
final
curve Curve
Animation curve used by the shake motion.
final
duration Duration
Total duration of the shake animation.
final
hashCode int
The hash code for this object.
no setterinherited
offsets List<double>
Offset values used to build the shake motion.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
weights List<double>
Weights for each shake segment.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited