animation - 左右翻转动画在ionic 2中不起作用
问题描述
我正在使用 ionic 2 应用程序并面临翻转动画的问题。
我想在 ion-col 上放一个翻转动画(向左翻转和向右翻转),但有时翻转动画不起作用。
我指的是下面链接中的翻转动画-
参考链接 - https://www.joshmorony.com/using-the-web-animations-api-in-ionic-2/
.html 代码
<ion-grid>
<ion-row>
<ion-col [@flip]="flipState" col-6
(swipe)="swipeEvent($event)">
</ion-col>
</ion-row>
</ion-grid>
.ts 代码
先设置动画
animations: [
trigger('flip', [
state('flipped', style({
transform: 'rotateY(360deg)',
})),
transition('* => flipped', animate('500ms ease'))
]),
]
})
当 swipeEvent 方法被调用时
swipeEvent(ev) {
if ((ev.direction === 2 || ev.direction === 4)) {
this.flipState = 'flipped';
}
}
解决方案
在 GitHub 上试试这个。这是我用作起点的那个
推荐阅读
- centos - 指定 Arch 时 Repodiff 不能按预期工作的任何原因?
- python - 为什么我在使用 pip 的 docker 中遇到 SSL 问题
- python - 使用 concurrent.futures.ProcessPoolExecutor 作为 loop.run_in_executor() 的执行程序的异步可迭代处理
- autohotkey - 如何在 AHK 中对 mouseclick 事件创建等效的“$”效果?
- jquery - 单击复选框时显示/隐藏 li 的子项
- r - 如何计算 R 中具有不同波段分辨率的 Sentinel-2 图像(来自 GEE)的缨帽变换?
- excel - 根据类似日历的数据填充行
- elasticsearch - 需要 Elasticsearch 容量规划帮助
- powershell - Azure SQL Powershell 命令的静默输出
- sql - SQL Case 语句,具有 2 个条件的别名值