SharedAnimationManager constructor
SharedAnimationManager(
- TickerProvider vsync
构造函数,初始化动画控制器和透明度动画。
Constructor to initialize the animation controller and opacity animation.
参数:
vsync
:TickerProvider,用于同步动画帧,通常由 State 对象提供。
Parameters:
- vsync: TickerProvider used to synchronize animation frames, typically provided by a State object.
Implementation
SharedAnimationManager(TickerProvider vsync) {
// 初始化动画控制器
_animationController = AnimationController(
vsync: vsync,
duration: const Duration(milliseconds: _opacityAnimationDuration),
);
// 初始化透明度动画
_opacityAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(parent: _animationController, curve: Curves.easeInOut),
);
}