Sobes.tech
Junior — Middle

What types of animation effects can you describe?

sobes.tech AI

Answer from AI

In Flutter, several types of animation effects can be described:

  • Tween Animation — smooth change of value from start to end using Tween and AnimationController.
  • Implicit Animations — animations that automatically animate property changes of widgets, such as AnimatedContainer, AnimatedOpacity.
  • Explicit Animations — more fine-grained control using AnimationController and listeners.
  • Physics-based Animations — animations based on physics, for example, using the SpringSimulation class.
  • Hero Animations — transition animation between screens with smooth movement of a shared element.

Example of a simple Tween Animation:

AnimationController controller = AnimationController(
  duration: const Duration(seconds: 2),
  vsync: this,
);
Animation<double> animation = Tween(begin: 0, end: 300).animate(controller);

// In build:
AnimatedBuilder(
  animation: animation,
  builder: (context, child) {
    return Container(
      width: animation.value,
      height: animation.value,
      color: Colors.blue,
    );
  },
);

controller.forward();