来源:自学PHP网 时间:2018-02-08 10:48 作者: 阅读:次
[导读] CSS animation-name属性指定应用的一系列动画名称,每个名称代表一个由@keyframes定义的动画序列。...
|
animation-name属性指定应用的一系列动画名称,每个名称代表一个由@keyframes定义的动画序列。 我们通常使用的简写属性可以很方便地同时设置所有的动画属性。 你可以为 如果你为
animation-name:none | IDENT
参数值:
例如下面代码的书写格式都是正确的:
animation-name: none
animation-name: test_05
animation-name: -specific
animation-name: sliding-vertically
animation-name: test1
animation-name: test1, animation4
animation-name: none, -moz-specific, sliding
animation-name: initial
animation-name: inherit
animation-name: unset
在下面的示例代码中, 由于
.element {
animation-name: bounce;
animation-duration: 3s;
animation-iteration-count: infinite;
}
.box {
animation-name: jump;
animation-duration: 2s;
animation-timing-function: ease-in-out;
}
.animated {
animation-name: bounce, change-bg-color;
animation-duration: 3s, 2s;
/* ... */
}
@keyframes change-bg-color {
from {
background-color: red;
}
to {
background-color: blue;
}
}
@keyframes bounce {
from {
top: 100px;
animation-timing-function: ease-out;
}
25% {
top: 50px;
animation-timing-function: ease-in;
}
50% {
top: 150px;
animation-timing-function: ease-out;
}
75% {
top: 75px;
animation-timing-function: ease-in;
}
to {
top: 100px;
}
}
适用范围
在线演示下面是一个小球做水平弹性运动的例子。小球运动中所做的
@keyframes bounceInRight {
0% {
opacity: 0;
-webkit-transform: translateX(600px);
-ms-transform: translateX(600px);
transform: translateX(600px);
}
60% {
opacity: 1;
-webkit-transform: translateX(-30px);
-ms-transform: translateX(-30px);
transform: translateX(-30px);
}
80% {
-webkit-transform: translateX(10px);
-ms-transform: translateX(10px);
transform: translateX(10px);
}
100% {
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
}
小球运动的一个周期时间为2秒,每个运动周期结束后做反向运动,小球的填充模式使用 animation-name: bounceInRight; animation-duration: 2s; animation-direction: alternate; animation-fill-mode: forwards; animation-iteration-count: infinite;
浏览器支持
完整的兼容性列表可以查看: |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com