<!doctype html>
<html>
<head>
<title>CSS3Animation</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
@keyframes myAnimation {
/* from {width: 500px;}
to { width: 200px;} */
0% /*時間百分比*/ {
width: 200px;
background-color: orange;
}
50% {
width: 500px;
background-color: tomato;
}
100% {
width: 50px;
background-color: mediumseagreen;
}
}
.box2{
width: 200px;
height: 200px;
background-color: orange;
overflow: hidden;
float : left;
clear: left;
animation-name: myAnimation; // 呼叫myAnimation指令
animation-duration: 8s; //運行時間
animation-delay: 1s; //delay時間
animation-iteration-count: 2; //運行次數
/*animation-iteration-count: infinite 無限循環*/
animation-direction: reverse; /*運行方向: 反向;*/
}
</style>
</head>
<body>
<div>
<div class="box2">
<h1>Title2</h1>
</div>
</div>
</body>
</html>