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}) {
  const curve = Curves.easeInOut;
  return {
    "opacity": TweenList<double>(
      [
        TweenPercentage(percent: 80, value: 1.0, curve: curve),
        TweenPercentage(percent: 100, value: 0.0, curve: curve),
      ],
    ),
    "translateY": TweenList<double>(
      [
        TweenPercentage(percent: 80, value: 0.0, curve: curve),
        TweenPercentage(
            percent: 100, value: 700.0 * preferences.magnitude, curve: curve),
      ],
    ),
    "rotateZ": TweenList<double>(
      [
        TweenPercentage(percent: 0, value: 0.0, curve: curve),
        TweenPercentage(
            percent: 20,
            value: 80.0 * toRad * preferences.magnitude,
            curve: curve),
        TweenPercentage(
            percent: 40,
            value: 60.0 * toRad * preferences.magnitude,
            curve: curve),
        TweenPercentage(
            percent: 60,
            value: 80.0 * toRad * preferences.magnitude,
            curve: curve),
        TweenPercentage(
            percent: 80,
            value: 60.0 * toRad * preferences.magnitude,
            curve: curve),
        TweenPercentage(percent: 100, value: 0.0, curve: curve),
      ],
    ),
  };
}