/* CSS3 动画示例代码 */
/* 定义关键帧 */
@keyframes example {
0% { background-color: red; left:0px; top:0px;}
25% { background-color: yellow; left:200px; top:0px;}
50% { background-color: blue; left:200px; top:200px;}
75% { background-color: green; left:0px; top:200px;}
100% { background-color: red; left:0px; top:0px;}
}
/* 应用动画到元素 */
#animate {
width: 100px;
height: 100px;
position: relative;
background-color: red;
animation-name: example;
animation-duration: 4s;
animation-iteration-count: infinite;
}
0%
到 100%
,每个百分比表示动画在该时间点的状态。这里我们改变了背景颜色和位置。@keyframes
中定义的名字)。infinite
表示无限循环。这段代码将使一个红色方块在 4 秒内改变颜色并移动,然后重复这个过程。
上一篇:css 自定义滚动条
下一篇:css文字删除线
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站