getDefinition method

  1. @override
Map<String, TweenList> getDefinition({
  1. Size? screenSize,
  2. Size? widgetSize,
})
override

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 m = Matrix4.identity();
  return {
    "transform": TweenList<Matrix4>(
      [
        TweenPercentage(percent: 0, value: m),
        TweenPercentage(
            percent: 30,
            value: m.scaled(1.0 + 0.25 * preferences.magnitude,
                1.0 - 0.25 * preferences.magnitude, 1.0)),
        TweenPercentage(
            percent: 40,
            value: m.scaled(1.0 - 0.25 * preferences.magnitude,
                1.0 + 0.25 * preferences.magnitude, 1.0)),
        TweenPercentage(
            percent: 50,
            value: m.scaled(1.0 + 0.15 * preferences.magnitude,
                1.0 - 0.15 * preferences.magnitude, 1.0)),
        TweenPercentage(
            percent: 65,
            value: m.scaled(1.0 - 0.05 * preferences.magnitude,
                1.0 + 0.05 * preferences.magnitude, 1.0)),
        TweenPercentage(
            percent: 75,
            value: m.scaled(1.0 + 0.05 * preferences.magnitude,
                1.0 - 0.05 * preferences.magnitude, 1.0)),
        TweenPercentage(percent: 100, value: m),
      ],
    ),
  };
}