<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Animations</title>
<style>
@keyframes myAnimation {
0% { transform: translateX(0); }
50% { transform: translateX(100px); }
100% { transform: translateX(0); }
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes changeColor {
0% { background-color: red; }
50% { background-color: yellow; }
100% { background-color: green; }
}
@keyframes move {
0% { transform: translateX(0); }
100% { transform: translateX(200px); }
}
@keyframes fade {
0% { opacity: 1; }
100% { opacity: 0; }
}
.box:hover {
background-color: blue;
transform: scale(1.2);
}
.box {
width: 100px;
height: 100px;
margin: 20px;
display: inline-block;
}
.move-box {
background-color: red;
animation: myAnimation 2s infinite;
}
.rotate-box {
background-color: blue;
animation: rotate 5s linear infinite;
}
.color-box {
animation: changeColor 3s infinite;
}
.combo-box {
background-color: purple;
animation: move 4s ease-in-out infinite, fade 2s ease-in-out infinite;
}
.transition-box {
background-color: green;
transition: background-color 1s, transform 0.5s;
}
</style>
</head>
<body>
<div class="box move-box"></div>
<div class="box rotate-box"></div>
<div class="box color-box"></div>
<div class="box combo-box"></div>
<div class="box transition-box"></div>
</body>
</html>