ShakeConfig class
Configuration for a shake animation.
ShakeConfig defines how the shake animation behaves, including:
- total duration
- animation curve
- movement offsets and corresponding weights
- shake axis direction (horizontal / vertical / both)
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:
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