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 cIn = Curves.easeIn;
  final cOut = Curves.easeOut;
  return {
    "scale": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: 1.0, curve: cOut),
        TweenPercentage(percent: 40, value: 1.0, curve: cOut),
        TweenPercentage(percent: 50, value: 1.0, curve: cIn),
        TweenPercentage(
            percent: 80,
            value: 1.0 - 0.05 * preferences.magnitude,
            curve: cIn),
        TweenPercentage(percent: 100, value: 1.0, curve: cIn),
      ],
    ),
    "translateZ": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: 0.0, curve: cOut),
        TweenPercentage(
            percent: 40, value: -150.0 * preferences.magnitude, curve: cOut),
        TweenPercentage(
            percent: 50, value: -150.0 * preferences.magnitude, curve: cIn),
        TweenPercentage(percent: 80, value: 0.0, curve: cIn),
      ],
    ),
    "rotateY": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: -360.0 * toRad, curve: cOut),
        TweenPercentage(percent: 40, value: -190.0 * toRad, curve: cOut),
        TweenPercentage(percent: 50, value: -170.0 * toRad, curve: cIn),
        TweenPercentage(percent: 80, value: 0.0, curve: cIn),
      ],
    ),
  };
}