animation - 如何在颤动中使用带有onSwipe事件的轮子旋转动画?
问题描述
我有一个轮子的图像,并尝试使用 onSwipe 事件在其上添加旋转动画。实际上我做了什么..我使用了 AnimatedBuider 类,但图像最初正在旋转。
这里的图像
AnimatedBuilder(
animation: animationController,
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/wheel.png", ),
fit: BoxFit.contain,
),
borderRadius: BorderRadius.all(Radius.circular(210.0)),
),
height: MediaQuery.of(context).size.height/2.3,
width: MediaQuery.of(context).size.width/1,
),
builder: (BuildContext context, Widget _widget) {
return new Transform.rotate(
angle: animationController.value * 6.3,
child: _widget,
);
},
),
动画控制器
@override
void initState() {
super.initState();
animationController = new AnimationController(
vsync: this,
duration: new Duration(seconds: 7),
);
animationController.repeat();
}
解决方案
推荐阅读
- xml - 在邮递员中按名称而不是按索引解析 XML 响应
- autodesk-forge - viewer.restoreState 在标记视图模式下不起作用
- python - 更改数据框中的背景颜色时出错
- azure-cosmosdb - Database.ReadAsync() 有什么用?
- sql - Postgresql中的SQL Server MERGE语句?
- python - 给定一个名称,返回一个带有消息的字符串:一个给 X,一个给我。X 是给定的名字。我写了代码,但没有传递任何参数时出错
- unreal-engine4 - 为什么我不能把这个静态网格雕像放在 UE4 中的这个静态网格 jar 中?
- active-directory - 在 Active Directory 中的计划备份
- javascript - 数据未使用 Android 存储在 Cloud Firestore 上
- php - Laravel 在空字段中更新或插入值