1、animation 动画

  概念:当您在 @keyframes 中创建动画时,请把它捆绑到某个选择器,否则不会产生动画效果。

  通过规定至少以下两项 CSS3 动画属性,即可将动画绑定到选择器:

  • 规定动画的名称
  • 规定动画的时长

把 "myMove" 动画捆绑到 div 元素,时长:5 秒;

  1. 动画调用
  2. 调用动画的规则名称
  3. 动画持续的时间(可选)
  4. 动画的过渡类型
  5. 延迟时间
  6. 动画播放次数(默认1次,也可以成数字或者infinite则是无限循环)
  7. 是否停留在结束状态 forwards
  8. 反向运动 alternate 1

2、调用形式如下所示:---------------可以互相组合使用

 -webkit-animation: myMove 2s ;
-webkit-animation: myMove 2s linear 2s infinite ;无限循环
-webkit-animation: myMove 2s linear 2s 2 ;循环2次
-webkit-animation: myMove 2s linear 2s forwards ;停留在结束位置
-webkit-animation: myMove 4s linear 2s infinite alternate ;反向运动不能在1次运动时实现,播放次数必须在2次或2次以上才可以实现

3、复杂的动画调用规则:

A、动画规则的设置:

 @-webkit-keyframes myMove {
from{
margin-left: 0px;
background-color: orange;
}to{
margin-left: 200px;
background-color: rosybrown;
}
}

B、动画规则的设置,用百分比实现

 @-webkit-keyframes myMove{

 0%{ width: 200px; }
20%{ width: 200px; }
40%{width: 200px; }
60%{ width: 200px; }
100%{ width: 200px; }
}

4、暂停动画:

代码:animation-play-state: paused;

用途:用在轮播上,要借用hover属性来实现;表示鼠标移上去是动画停止,移出时动画继续

实例:

下面是调用动画:

 #boxhidden{
border: 1px solid rosybrown;
width: 320px;
height: 213px;
overflow: hidden;
} #boximg{
height: 213px;
width: 1920px;
font-size:;
animation: imgmove 4s linear infinite;
}
#boximg:hover{
animation-play-state: paused;
}

动画规则设置:

 @-webkit-keyframes imgmove {
0%{margin-left: 0px; } 10%{margin-left: -320px; }20%{ margin-left: -320px; }
30%{ margin-left: -640px; }40%{margin-left: -640px; }50%{margin-left: -960px; }
60%{ margin-left: -960px; }70%{margin-left: -1280px; }80%{margin-left: -1280px}
90%{margin-left: -1600px} 100%{margin-left: -1600px}
}

animation(动画)设置的更多相关文章

  1. Android中xml设置Animation动画效果详解

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...

  2. android中设置Animation 动画效果

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...

  3. CSS3 animation 动画

    今天看到一个很酷的logo看了下他用的是animation 动画效果,就拿来做例子 浏览器支持 Internet Explorer 10.Firefox 以及 Opera 支持 animation 属 ...

  4. Android Property Animation动画

    3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中又引入了一个新的动画系统:property animation,这三 ...

  5. android Animation 动画绘制逻辑

    参考:http://www.jianshu.com/p/3683a69c38ea 1.View.draw(Canvas) 其中步骤为:/* * Draw traversal performs seve ...

  6. 转 iOS Core Animation 动画 入门学习(一)基础

    iOS Core Animation 动画 入门学习(一)基础 reference:https://developer.apple.com/library/ios/documentation/Coco ...

  7. css3 animation动画技巧

    一,css3 animation动画前言 随着现在浏览器对css3的兼容性越来越好,使用css3动画来制作动画的例子也越来越广泛,也随着而来带来了许多的问题值得我们能思考.css3动画如何让物体运动更 ...

  8. 【Android 基础】Animation 动画介绍和实现

    在前面PopupWindow 实现显示仿腾讯新闻底部弹出菜单有用到Animation动画效果来实现菜单的显示和隐藏,本文就来介绍下吧. 1.Animation 动画类型 Android的animati ...

  9. Android Animation 动画属性

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现: 一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...

  10. [转]Animation 动画详解(一)——alpha、scale、translate、rotate、set的xml属性及用法

    转载:http://blog.csdn.net/harvic880925/article/details/39996643 前言:这几天做客户回访,感触很大,用户只要是留反馈信息,总是一种恨铁不成钢的 ...

随机推荐

  1. python读写不同编码txt文件

        以后整理规范 import os import codecs filenames=os.listdir(os.getcwd()) out=file("name.txt",& ...

  2. intellij-maven-imports-have-broken-classpath

    公司自己搭得maven私服,然后使用git下载 公司mvn的依赖包时候,报错: 之后再idea里面发现依赖的jar包 有红色的错误信息,提示 maven imports have broken cla ...

  3. C++中protected的访问权限

    关于C++中protected的访问权限的讨论已经是一个很陈旧的话题了,陈旧到大家都不愿意去讨论,觉得他见到到吃饭睡觉那么自然. 我再次读<C++ Primer>的时候,其中关于prote ...

  4. 【Leetcode】【Medium】Multiply Strings

    Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...

  5. 使用DIDatepicker

    使用DIDatepicker https://github.com/noxt/DIDatepicker 效果: #import "DIViewController.h" #impo ...

  6. photo的复数是photos

    以O结尾的单词变复数时,有生命的加es,无生命的加s. 如:photo,zoo,为无生命的,+s tomato,potato为有生命的,+es. 自己总结的,但到目前为止还没有遇到过例外的.记住这一个 ...

  7. 如何用SAP Cloud for Customer的手机App创建销售订单

    第一次启动App,设置一个初始化的pin code: 输入C4C tenant的url,用户名和密码: 登录进系统后,找到Sales Order工作中心: 可以看到系统里很多已有的销售订单了.点击屏幕 ...

  8. tftp传输可执行程序问题

    昨天搭建了板子从nfs系统启动,这样只要在开发机上编写程序编译,就可以在板子上测试运行了,编写了hello world 程序,用arm编译器编译,在主板上运行,提示出错:什么exception ((什 ...

  9. 【[HAOI2009]逆序对数列】

    发现自己学了几天splay已经傻了 其实还是一个比较裸的dp的,但是还是想了一小会,还sb的wa了几次 首先这道题的状态应该很好看出,我们用\(f[i][j]\)表示在前\(i\)个数中(即\(1-i ...

  10. 【[USACO09DEC]牛收费路径Cow Toll Paths】

    很妙的一道题,我之前一直是用一个非常暴力的做法 就是枚举点权跑堆优化dijkstra 但是询问次数太多了 于是一直只有50分 今天终于抄做了这道题,不贴代码了,只说一下对这道题的理解 首先点权和边权不 ...