<style>
.progress span {
position: absolute;
width: 300px;
height: 20px;
border: 2px solid red;
}
.progress span::after {
content: '';
position: absolute;
width: 0;
height: 100%;
background-color: red;
}
.progress:hover span::after {
width: 100%;
transition: width 5s ease;
}
</style>
<div class="progress">
<span></span>
</div>
3D旋转木马
<style>
body {
perspective: 1000px;
}
ul {
width: 400px;
height: 400px;
top: 200px;
margin: 0 auto;
position: relative;
list-style: none;
transform-style: preserve-3d;
position: relative;
background-image: url(./pig.jpg);
animation: aaa 6s linear infinite;
}
ul:hover {
animation-play-state: paused;
}
ul li {
position: absolute;
}
ul li:nth-child(1) {
transform: rotateY(0) translateZ(300px);
}
ul li:nth-child(2) {
transform: rotateY(60deg) translateZ(300px);
}
ul li:nth-child(3) {
transform: rotateY(120deg) translateZ(300px);
}
ul li:nth-child(4) {
transform: rotateY(180deg) translateZ(300px);
}
ul li:nth-child(5) {
transform: rotateY(240deg) translateZ(300px);
}
ul li:nth-child(6) {
transform: rotateY(300deg) translateZ(300px);
}
@keyframes aaa {
0% {
transform: rotateY(0);
}
100% {
transform: rotateY(300deg);
}
}
</style>
<ul>
<li><img src="./dog.jpg" alt=""></li>
<li><img src="./dog.jpg" alt=""></li>
<li><img src="./dog.jpg" alt=""></li>
<li><img src="./dog.jpg" alt=""></li>
<li><img src="./dog.jpg" alt=""></li>
<li><img src="./dog.jpg" alt=""></li>
</ul>