<!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>Document</title>
<style>
.an-box {
position: relative;
width: 299px;
height: 299px;
margin: 50px auto 45px;
}
.an-box .png {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: .5s;
}
.inner-img0 {
width: 299px;
height: 299px;
background: url(./images/page2_img4.png) no-repeat;
}
.inner-img1 {
width: 226px;
height: 226px;
background: url(./images/page2_img3.png) no-repeat;
}
.inner-img2 {
width: 185px;
height: 185px;
background: url(./images/page2_img2.png) no-repeat;
}
.inner-img3 {
width: 167px;
height: 167px;
background: url(./images/page2_img1.png) no-repeat;
}
/* 旋转时移动属性也要保持原来的属性!!!否则旋转过程中,中心点位置会发生变化,导致图片并不会按照设定旋转 */
.an-box:hover .inner-img0 {
transform: translate(-50%,-50%) rotate(-180deg);
}
.an-box:hover .inner-img2 {
transform: translate(-50%,-50%) rotate(270deg);
}
.an-box:hover .inner-img3 {
transform: translate(-50%,-50%) rotate(-360deg);
}
.an-box:hover .inner-img1 {
transform: translate(-50%,-50%) rotate(360deg);
}
</style>
</head>
<body>
<div class="an-box">
<div class="inner-img0 png"></div>
<div class="inner-img1 png"></div>
<div class="inner-img2 png"></div>
<div class="inner-img3 png"></div>
</div>
</body>
</html>