angular - 如何用Angular6制作无限动画?
问题描述
我使用 html 和 css 制作了一辆 3d 卡车。如果任何变量 ( x ) 为真,则卡车轮胎旋转 360 度。如果 x=false,卡车轮胎停止转动。我用 css 做这个,只是为了无限旋转。
.whell{
animation: round 2s infinite linear ;
}
@keyframes round {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
此 css 代码正在工作,但不会根据变量停止轮胎。我决定用 Angular Animations 制作;
animations: [
trigger('x',[
state('true', style({
transform: 'rotate(360deg)'
})),
transition('* => *', animate('2s'))
])
]
卡车的轮胎正在旋转,但只有 2 秒。有没有办法在 Angular6 中无限旋转它?我想要无限,而不是 2 秒。如果您能提供帮助,我将不胜感激。谢谢...
解决方案
像这样使用它怎么样:
[ngClass]="x?'whell':'classWithNoAnimation'"
如果 x 为真,则切换到地狱,否则切换到 classWithNoAnimation
推荐阅读
- git - Git:man 命令不起作用
- python - 使用 pyinstaller 更新或添加新数据文件到 exe
- python - 使用 str() 时出错
- java - 在 Android 上未调用 SendBird ChannelHandler onMessageReceived
- laravel - 无法访问与 appServiceProvider 的关系
- php - 每次指定值出现在单独的数组中时,PHP 都会中断数组
- google-maps - -canOpenURL:URL 失败:“comgooglemaps://” - 错误:“操作无法完成
- wso2 - 如何使用自定义声明 URL 和值在 WSO2 API 管理器中导入批量用户
- c - C 如何评估这些程序?
- html - Angular 应用程序在加载时卡住了。(可能是类似@Input() 的错误 idk)