Flutter 如何在颤振中变换背景图像?
我希望每当我加载屏幕时,背景图像应该放大然后缩小。我怎样才能实现这种效果呢?添加这个初始化状态代码,您需要它来设置页面动画Flutter 如何在颤振中变换背景图像?,flutter,flutter-animation,Flutter,Flutter Animation,我希望每当我加载屏幕时,背景图像应该放大然后缩小。我怎样才能实现这种效果呢?添加这个初始化状态代码,您需要它来设置页面动画 void initState() { super.initState(); animationController = new AnimationController( vsync: this, duration: new Duration(seconds: 3)); animation = new CurvedAnima
void initState() {
super.initState();
animationController = new AnimationController(
vsync: this, duration: new Duration(seconds: 3));
animation =
new CurvedAnimation(parent: animationController, curve: Curves.easeOut);
animation.addListener(() => this.setState(() {}));
animationController.forward();
setState(() {
_visible = !_visible;
});
}
并将其添加到您的图像小部件中
new Image.asset('assets/images/background.png',
width: animation.value * 250,
height: animation.value * 250,
),
检查