<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animation</title>
<style>
div {
width: 100px;
height: 100px;
background: #f00;
position: absolute;
left: 0;
top: 0;
animation: boxAni 5s;
}
@keyframes boxAni {
0% {
position: absolute;
left: 0;
top: 0;
background: #f00;
}
25% {
position: absolute;
left: 500px;
top: 0;
background: #ff0;
}
50% {
position: absolute;
left: 500px;
top: 500px;
background: #00f;
}
75% {
position: absolute;
left: 0;
top: 500px;
background: green;
}
100% {
position: absolute;
left: 0;
top: 0;
background: #f00;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>