前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ionic3学习笔记(五)动画之使用 animate.css

Ionic3学习笔记(五)动画之使用 animate.css

作者头像
Theo Tsao
发布2018-09-07 16:13:30
1K0
发布2018-09-07 16:13:30
举报
文章被收录于专栏:Theo TsaoTheo Tsao

目录

  1. 前言
  2. animate.css 的使用
  3. animate.scss 的使用

1. 前言

animate.css 是一款强大的、跨浏览器的预设CSS3动画库,内置了很多典型的CSS3动画,兼容性好使用方便,可以应用于我们的基于Ionic3的Hybrid App,在这里你可以看到各个动画的动画效果,现在最新的版本是3.5.2,强烈建议大家使用。

animate.scss 是基于上述 animate.css 的SASS版本,不过已经两年没有更新了,止于3.2.2版本,不过也包含了 animate.css 的大部分动画,不妨碍我们的使用。

2. animate.css 的使用

animate.css GitHub地址 https://github.com/daneden/animate.css

可在 https://daneden.github.io/animate.css/ 查看具体动画效果

使用方法:

(1) 在 ./src/assets 文件夹下创建 css 文件夹,将 animate.css 拷贝到 ./src/assets/css 文件夹下

(2) 在 ./src.index.html 中导入 animate.css

代码语言:javascript
复制
<link rel="stylesheet" href="assets/css/animate.css">

(3) 对你要添加动画的对象加上指定的动画,如:我在 ./src/pages/exam/exam.html 文件中添加

代码语言:javascript
复制
<ion-card class="animated bounceIn">

......

</ion-card>

如果想要动画效果永远存在,可以加上 infinite 字段,如:我在 ./src/pages/exam/exam.html 文件中添加

代码语言:javascript
复制
<ion-card class="animated infinite bounce">

......

</ion-card>

支持的动画效果有如下:

代码语言:javascript
复制
bounce
flash
pulse
rubberBand
shake
headShake
swing
tada
wobble
jello
bounceIn
bounceInDown
bounceInLeft
bounceInRight
bounceInUp
bounceOut
bounceOutDown
bounceOutLeft
bounceOutRight
bounceOutUp
fadeIn
fadeInDown
fadeInDownBig
fadeInLeft
fadeInLeftBig
fadeInRight
fadeInRightBig
fadeInUp
fadeInUpBig
fadeOut
fadeOutDown
fadeOutDownBig
fadeOutLeft
fadeOutLeftBig
fadeOutRight
fadeOutRightBig
fadeOutUp
fadeOutUpBig
flipInX
flipInY
flipOutX
flipOutY
lightSpeedIn
lightSpeedOut
rotateIn
rotateInDownLeft
rotateInDownRight
rotateInUpLeft
rotateInUpRight
rotateOut
rotateOutDownLeft
rotateOutDownRight
rotateOutUpLeft
rotateOutUpRight
hinge
jackInTheBox
rollIn
rollOut
zoomIn
zoomInDown
zoomInLeft
zoomInRight
zoomInUp
zoomOut
zoomOutDown
zoomOutLeft
zoomOutRight
zoomOutUp
slideInDown
slideInLeft
slideInRight
slideInUp
slideOutDown
slideOutLeft
slideOutRight
slideOutUp

3. animate.scss 的使用

animate.scss GitHub地址 https://github.com/geoffgraham/animate.scss

(1) 在 ./src/assets 文件夹下创建 animate 文件夹,将 git clone 下来的文件夹下的所有文件拷贝到 animate 文件夹下。

(2) 在 ./src/app/app.scss 文件中导入 animate.scss

代码语言:javascript
复制
@import "../assets/animate/animate.scss";

(3) 对你要添加动画的对象加上指定的动画,如:我在 ./src/pages/exam/exam.scss 文件中添加

代码语言:javascript
复制
ion-card {
    @include bounceIn();
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-10-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 前言
  • 2. animate.css 的使用
  • 3. animate.scss 的使用
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档