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 c0 = Cubic(0.55, 0.55, 0.675, 0.19);
  final c1 = Cubic(0.175, 0.885, 0.32, 1.0);
  return {
    "opacity": TweenList<double>(
      [
        TweenPercentage(percent: 40, value: 1.0, curve: c0),
        TweenPercentage(percent: 100, value: 0.0, curve: c1),
      ],
    ),
    "scale": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: 1.0, curve: c0),
        TweenPercentage(
            percent: 40,
            value: 1.0 - 0.525 * preferences.magnitude,
            curve: c0),
        TweenPercentage(
            percent: 100,
            value: 1.0 - 0.9 * preferences.magnitude,
            curve: c1),
      ],
    ),
    "translateY": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: 0.0, curve: c0),
        TweenPercentage(
            percent: 40, value: -60.0 * preferences.magnitude, curve: c0),
        TweenPercentage(percent: 100, value: screenSize!.height, curve: c1),
      ],
    ),
  };
}