getDefinition method
AnimatorWidget calls getDefinition to gather the animation. Animations are defined using named TweenLists using a Map<String, TweenList>. Example: @override Map<String, TweenList> getDefinition({Size screenSize, Size widgetSize}) { return { "opacity": TweenList
Implementation
@override
Map<String, TweenList> getDefinition({Size? screenSize, Size? widgetSize}) {
final a = 0.0;
final b = -10.0 * preferences.magnitude;
final c = 10.0 * preferences.magnitude;
return {
"translateX": TweenList<double>(
[
TweenPercentage(percent: 0, value: a),
TweenPercentage(percent: 10, value: b),
TweenPercentage(percent: 20, value: c),
TweenPercentage(percent: 30, value: b),
TweenPercentage(percent: 40, value: c),
TweenPercentage(percent: 50, value: b),
TweenPercentage(percent: 60, value: c),
TweenPercentage(percent: 70, value: b),
TweenPercentage(percent: 80, value: c),
TweenPercentage(percent: 90, value: b),
TweenPercentage(percent: 100, value: a),
],
),
};
}