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 axis = Math.Vector3(0.0, 0.0, 1.0);
final m = Matrix4.identity();
final m10 = m.scaled(1.0 - 0.1 * preferences.magnitude);
m10.rotate(axis, -3.0 * toRad * preferences.magnitude);
final m30 = m.scaled(1.0 + 0.1 * preferences.magnitude);
m30.rotate(axis, 3.0 * toRad * preferences.magnitude);
final m40 = m.scaled(1.0 + 0.1 * preferences.magnitude);
m40.rotate(axis, -3.0 * toRad * preferences.magnitude);
return {
"transform": TweenList<Matrix4>(
[
TweenPercentage(percent: 0, value: m),
TweenPercentage(percent: 10, value: m10),
TweenPercentage(percent: 20, value: m10),
TweenPercentage(percent: 30, value: m30),
TweenPercentage(percent: 40, value: m40),
TweenPercentage(percent: 50, value: m30),
TweenPercentage(percent: 60, value: m40),
TweenPercentage(percent: 70, value: m30),
TweenPercentage(percent: 80, value: m40),
TweenPercentage(percent: 90, value: m30),
TweenPercentage(percent: 100, value: m),
],
),
};
}