slide static method

MotionWidgetBuilder slide({
  1. required Alignment begin,
  2. required Alignment end,
  3. double factor = 1.0,
})

Animates the position relative to its normal position.

The translation is expressed as an Alignment scaled to the child's size multiplied by the given factor. For example, an Alignment with a dx of 0.25 and a factor of 2 will result in a horizontal translation of one half (two quarters) the width of the child.

Implementation

static MotionWidgetBuilder slide({
  required Alignment begin,
  required Alignment end,
  double factor = 1.0,
}) =>
    (
      BuildContext context,
      MontageAnimation current,
      Animation<double> animation,
      Widget? child,
    ) {
      return SlideTransition(
        position: Tween(
          begin: Offset(begin.x * 2 * factor, begin.y * 2 * factor),
          end: Offset(end.x * 2 * factor, end.y * 2 * factor),
        ).animate(animation),
        child: child,
      );
    };