amazeui学习笔记--css(常用组件15)--CSS动画Animation

一、总结

1、css3动画封装:CSS3 动画封装,浏览器需支持 CSS3 动画。

Class 描述
.am-animation-fade 淡入
.am-animation-scale-up 逐渐放大
.am-animation-scale-down 逐渐缩小
.am-animation-slide-top 顶部滑入
.am-animation-slide-bottom 底部滑入
.am-animation-slide-left 左侧滑入
.am-animation-slide-right 右侧滑入
.am-animation-shake 左右摇动
.am-animation-spin 无限旋转

2、基本使用(这个好): <div class="am-animation-fade">...</div>

3、一直旋转的icon<span class="am-icon-cog am-animation-spin"></span>

4、反向动画:添加 .am-animation-reverse class,让动画反向运行(通过把 animation-direction 设置为 reverse 实现)。

<div class="am-animation-fade am-animation-reverse">...</div>

<span class="am-icon-cog am-animation-spin am-animation-reverse"></span>

5、动画延迟执行:添加以下 class 可以使动画延迟 1-6s 执行。

  • .am-animation-delay-1
  • .am-animation-delay-2
  • .am-animation-delay-3
  • .am-animation-delay-4
  • .am-animation-delay-5
  • .am-animation-delay-6

自定义延时:

.my-animation-delay {
-webkit-animation-delay: 15s;
animation-delay: 15s;
}
<p><button type="button" class="am-btn am-btn-primary am-animation-delay-1">延迟 1s 执行</button></p>

二、CSS动画Animation

Animation


CSS3 动画封装,浏览器需支持 CSS3 动画。

Class 描述
.am-animation-fade 淡入
.am-animation-scale-up 逐渐放大
.am-animation-scale-down 逐渐缩小
.am-animation-slide-top 顶部滑入
.am-animation-slide-bottom 底部滑入
.am-animation-slide-left 左侧滑入
.am-animation-slide-right 右侧滑入
.am-animation-shake 左右摇动
.am-animation-spin 无限旋转

使用演示

点击按钮查看动画效果。

默认效果

 Copy
Fade
Scale Up
Scale Down
Slide Top
Slide Bottom
Slide Left
Slide Right
Shake
<div class="am-animation-fade">...</div>

<span class="am-icon-cog am-animation-spin"></span>

反向动画

添加 .am-animation-reverse class,让动画反向运行(通过把 animation-direction 设置为 reverse 实现)。

 Copy
Fade
Scale Up
Scale Down
Slide Top
Slide Bottom
Slide Left
Slide Right
Shake
<div class="am-animation-fade am-animation-reverse">...</div>

<span class="am-icon-cog am-animation-spin am-animation-reverse"></span>

动画延迟执行

添加以下 class 可以使动画延迟 1-6s 执行。

  • .am-animation-delay-1
  • .am-animation-delay-2
  • .am-animation-delay-3
  • .am-animation-delay-4
  • .am-animation-delay-5
  • .am-animation-delay-6

自定义延时:

 Copy
.my-animation-delay {
-webkit-animation-delay: 15s;
animation-delay: 15s;
}
 Copy
点击开始执行动画

没延迟的动画

延迟 1s 执行

延迟 2s 执行

延迟 3s 执行

延迟 4s 执行

延迟 5s 执行

延迟 6s 执行

<button id="animation-start" type="button" class="am-btn am-btn-danger">点击开始执行动画</button>

<hr/>

<div id="animation-group">
<p><button type="button" class="am-btn am-btn-primary">没延迟的动画</button></p> <p><button type="button" class="am-btn am-btn-primary am-animation-delay-1">延迟 1s 执行</button></p>
<p><button type="button" class="am-btn am-btn-secondary am-animation-delay-2">延迟 2s 执行</button></p>
<p><button type="button" class="am-btn am-btn-success am-animation-delay-3">延迟 3s 执行</button></p>
<p><button type="button" class="am-btn am-btn-warning am-animation-delay-4">延迟 4s 执行</button></p>
<p><button type="button" class="am-btn am-btn-danger am-animation-delay-5">延迟 5s 执行</button></p>
<p><button type="button" class="am-btn am-btn-primary am-animation-delay-6">延迟 6s 执行</button></p>
</div> <script>
$(function() {
var $btns = $('#animation-group').find('.am-btn');
var dfds = [];
var animating = false;
var animation = 'am-animation-scale-up'; $('#animation-start').on('click', function() {
if (!animating) {
animating = true;
$btns.each(function() {
var dfd = new $.Deferred();
dfds.push(dfd);
var $this = $(this);
if ($.AMUI.support.animation) {
$this.addClass(animation).one($.AMUI.support.animation.end, function() {
$this.removeClass(animation);
dfd.resolve();
});
}
}); $.when.apply(null, dfds).done(function() {
animating = false;
console.log('[AMUI] - 所有动画执行完成');
dfds = [];
});
}
});
});
</script>

参考资源

amazeui学习笔记--css(常用组件15)--CSS动画Animation的更多相关文章

  1. amazeui学习笔记--css(常用组件13)--进度条Progress

    amazeui学习笔记--css(常用组件13)--进度条Progress 一.总结 1.进度条基本使用:进度条组件,.am-progress 为容器,.am-progress-bar 为进度显示信息 ...

  2. amazeui学习笔记--css(常用组件5)--评论列表Comment

    amazeui学习笔记--css(常用组件5)--评论列表Comment 一.总结 1.am-comment:使用am-comment来声明评论对象,这个是放在article里面的,虽然article ...

  3. amazeui学习笔记--css(常用组件16)--文章页Article

    amazeui学习笔记--css(常用组件16)--文章页Article 一.总结 1.基本使用:文章内容页的排版样式,包括标题.文章元信息.分隔线等样式. .am-article 文章内容容器 .a ...

  4. amazeui学习笔记--css(常用组件14)--缩略图Thumbnail

    amazeui学习笔记--css(常用组件14)--缩略图Thumbnail 一.总结 1.基本样式:在 <img> 添加 .am-thumbnail 类:也可以在 <img> ...

  5. amazeui学习笔记--css(常用组件12)--面板Panel

    amazeui学习笔记--css(常用组件12)--面板Panel 一.总结 1.面板基本样式:默认的 .am-panel 提供基本的阴影和边距,默认边框添加 .am-panel-default,内容 ...

  6. amazeui学习笔记--css(常用组件11)--分页Pagination

    amazeui学习笔记--css(常用组件11)--分页Pagination 一.总结 1.分页使用:还是ul包li的形式: 分页组件,<ul> / <ol> 添加 .am-p ...

  7. amazeui学习笔记--css(常用组件10)--导航条Topbar

    amazeui学习笔记--css(常用组件10)--导航条Topbar 一.总结 1. 导航条:就是页面最顶端的导航条:在容器上添加 .am-topbar class,然后按照示例组织所需内容.< ...

  8. amazeui学习笔记--css(常用组件9)--导航nav

    amazeui学习笔记--css(常用组件9)--导航nav 一.总结 1.导航基本使用:<ul> 添加 .am-nav class 以后就是一个基本的垂直导航.默认样式中并没有限定导航的 ...

  9. amazeui学习笔记--css(常用组件8)--列表list

    amazeui学习笔记--css(常用组件8)--列表list 一.总结 1.链接列表:就是多个链接在一起组成的列表, 使用 <ul> 结构嵌套链接列表,添加 .am-list.还是ui包 ...

随机推荐

  1. 紫书 习题 10-18 UVa 10837 (欧拉函数变形)

    这道题很巧妙,要把式子变一下 phi(n) = n * (1 - 1 / p1) * (1 - 1 / p2)--(1 - 1 / pr) = n * ((p1-1) / p1) * ((p1-2) ...

  2. iOS8开发~Swift(五)Swift与OC混编

    一.概要 首先看<The Swift Programming Language>中提到"Swift's compatibility with Objective-C lets y ...

  3. xml中控件调用构造方法

    系统控件view有三个构造方法,分别如下 public DrawView(Context context) { super(context); } public DrawView(Context co ...

  4. layer:web弹出层解决方案

    layer:web弹出层解决方案 一.总结 一句话总结:http://layer.layui.com/ 1.layer中弹出层tips的使用(代码)是怎样的? 使用还是比较简单方便的 //tips层- ...

  5. 72.调用req.flash('error', '用户已存在!'); 时候 报错 "req.flash is not a function"

    在app.js 中调用app.use 的顺序有关 app.use(session({ secret: settings.cookieSecret, key: settings.db,//cookie ...

  6. Http1.1和http2.0

    HTTP2.0 最近在读一本书叫<web性能权威指南>谷歌公司高性能团队核心成员的权威之作. 一直听说HTTP2.0,对此也仅仅是耳闻,没有具体研读过,这次正好有两个篇章,分别讲HTTP1 ...

  7. 用AOP改善javascript代码

    Aop又叫面向切面编程,用过spring的同学肯定对它非常熟悉,而在js中,AOP是一个被严重忽视的技术点,这篇就通过下面这几个小例子,来说说AOP在js中的妙用. 1, 防止window.onloa ...

  8. Hive里的分区、分桶、视图和索引再谈

    福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑         Java全栈大联盟   ...

  9. Android Gson解析json工具类封装

    package com.springSecurity.gson; import java.util.ArrayList; import java.util.List; import java.util ...

  10. 给网站设置ICO图标

    方法一:         直接在站点根目录下放入名为:favicon.ico 的图标文件(必须要为 ICO 文件,BMP 及其他格式的图片文件不行).还有将 favicon.ico 中的 favico ...