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. 【Nginx从入门到实战】

    目录 1. 网站服务 2. 所谓Nginx 3. 安装Nginx 4. Nginx配置文件详述 5. 开始玩转Nginx Nginx虚拟主机 Nginx状态信息(status)配置 Nginx错误页面 ...

  2. CMDB学习之七-实现采集错误捕捉,日志信息处理

    首先采集disk的具体实现方上代码: # !/usr/bin/env python # -*- coding:utf-8 -*- from .base import BasePlugin import ...

  3. Python入门:全站url爬取

    <p>作为一个安全测试人员,面对一个大型网站的时候,手工测试很有可能测试不全,这时候就非常需要一个通用型的网站扫描器.当然能直接扫出漏洞的工具也有很多,但这样你只能算是一个工具使用者,对于 ...

  4. [React] Write Compound Components

    Compound component gives more rendering control to the user. The functionality of the component stay ...

  5. 59.node的serve-favicon中间件的使用

    转自:https://www.zhi-jie.net/node-serve-favicon-use/ 有一个名称为serve-favicon的中间件,可以用于请求网页的favicon图标.譬如如下的使 ...

  6. 13.Axis创建webservice客户端和服务端

    转自:https://blog.csdn.net/chenghui0317/article/details/9318317 一.Axis的介绍 Web Service是现在最适合实现SOA的技术,而A ...

  7. 11.Axis客户端接收不同参数类型

    转自:http://www.guance.com/708.html axis只支持简单类型的返回值.在这里逐一介绍axis的各种返回值接受. 1. axis接受基本类型,如int, string等 引 ...

  8. 【bzoj4864】神秘物质

    Description 给出一个长度为n的序列,第i个数为ai,进行以下四种操作: merge x e:将当前第x个数和第x+1个数合并,得到一个新的数e: insert x e:在当前第x个数和第x ...

  9. 【Django】序列化

    Django中序列化主要应用于将数据库中检索的数据返回给客户端用户,特别是Ajax请求一般返回为Json格式. * 1.from django.core import serializers** fr ...

  10. Flask的快速入门详细笔记

    Flask的框架结构对应关系及理解 1.简介 简单介绍下Flask是一个轻量级的web前端框架,不像django那样本身具备一套完整的页面体系,轻量级说明了完全可以自定义,从功能逻辑到业务处理,都可以 ...