一个简单的淡入淡出、滑动、旋转等动画效果案例代码
动画效果:动画效果可以增加网页的交互性和吸引力。常见的动画效果包括淡入淡出、滑动、旋转等。

以下是一个简单的淡入淡出、滑动、旋转等动画效果案例代码展示:
<!DOCTYPE html>
<html>
<head>
<title>动画效果案例</title>
<style>
.fade-in-out {
width: 100px;
height: 100px;
background-color: red;
opacity: 0;
animation: fade 2s infinite alternate;
}
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.slide {
width: 100px;
height: 100px;
background-color: blue;
position: relative;
animation: slide 2s infinite alternate;
}
@keyframes slide {
0% {
left: 0;
}
100% {
left: 200px;
}
}
.rotate {
width: 100px;
height: 100px;
background-color: green;
position: relative;
animation: rotate 2s infinite linear;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="fade-in-out"></div>
<div class="slide"></div>
<div class="rotate"></div>
</body>
</html>
