是通过添加伪元素的方式,比那个移动z轴的好点,没有阴影存在,但是有抖动
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>GBP</title>
<style>
/* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */
.purse {
height: 160px;
width: 160px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -80px;
margin-left: -80px;
-webkit-perspective: 1000;
-webkit-box-reflect: below 0 linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.2));
-webkit-filter: saturate(1.45) hue-rotate(2deg);
}
.coin {
height: 160px;
width: 160px;
position: absolute;
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 50%;
-webkit-animation: spin 2s infinite;
-webkit-animation-timing-function: linear;
}
.coin .front,
.coin .back {
position: absolute;
height: 160px;
width: 160px;
border-radius: 50%;
background-size: cover;
}
.coin .front {
-webkit-transform: translateZ(8px);
}
.coin .back {
-webkit-transform: translateZ(-8px) rotateY(180deg);
}
.coin .side {
-webkit-transform: translateX(72px);
-webkit-transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
}
.coin .side .spoke {
height: 160px;
width: 16px;
position: absolute;
-webkit-transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
}
.coin .side .spoke:before,
.coin .side .spoke:after {
content: '';
display: block;
height: 15.68274245px;
width: 16px;
position: absolute;
-webkit-transform: rotateX(84.375deg);
background: #d8be83;
background: linear-gradient(to bottom, #e6cf99 0%, #e6cf99 74%, #c2a970 75%, #c2a970 100%);
background-size: 100% 3.48505388px;
}
.coin .side .spoke:before {
-webkit-transform-origin: top center;
}
.coin .side .spoke:after {
bottom: 0;
-webkit-transform-origin: center bottom;
}
.coin .side .spoke:nth-child(16) {
-webkit-transform: rotateY(90deg) rotateX(180deg);
}
.coin .side .spoke:nth-child(15) {
-webkit-transform: rotateY(90deg) rotateX(168.75deg);
}
.coin .side .spoke:nth-child(14) {
-webkit-transform: rotateY(90deg) rotateX(157.5deg);
}
.coin .side .spoke:nth-child(13) {
-webkit-transform: rotateY(90deg) rotateX(146.25deg);
}
.coin .side .spoke:nth-child(12) {
-webkit-transform: rotateY(90deg) rotateX(135deg);
}
.coin .side .spoke:nth-child(11) {
-webkit-transform: rotateY(90deg) rotateX(123.75deg);
}
.coin .side .spoke:nth-child(10) {
-webkit-transform: rotateY(90deg) rotateX(112.5deg);
}
.coin .side .spoke:nth-child(9) {
-webkit-transform: rotateY(90deg) rotateX(101.25deg);
}
.coin .side .spoke:nth-child(8) {
-webkit-transform: rotateY(90deg) rotateX(90deg);
}
.coin .side .spoke:nth-child(7) {
-webkit-transform: rotateY(90deg) rotateX(78.75deg);
}
.coin .side .spoke:nth-child(6) {
-webkit-transform: rotateY(90deg) rotateX(67.5deg);
}
.coin .side .spoke:nth-child(5) {
-webkit-transform: rotateY(90deg) rotateX(56.25deg);
}
.coin .side .spoke:nth-child(4) {
-webkit-transform: rotateY(90deg) rotateX(45deg);
}
.coin .side .spoke:nth-child(3) {
-webkit-transform: rotateY(90deg) rotateX(33.75deg);
}
.coin .side .spoke:nth-child(2) {
-webkit-transform: rotateY(90deg) rotateX(22.5deg);
}
.coin .side .spoke:nth-child(1) {
-webkit-transform: rotateY(90deg) rotateX(11.25deg);
}
.coin.skeleton .front,
.coin.skeleton .back {
display: none;
}
.coin.skeleton .side,
.coin.skeleton .side .spoke,
.coin.skeleton .side .spoke:before,
.coin.skeleton .side .spoke:after {
-webkit-backface-visibility: visible;
}
.coin.skeleton .side .spoke {
background: rgba(170, 170, 170, 0.1);
}
.coin.skeleton .side .spoke:before {
background: rgba(255, 170, 170, 0.2);
}
.coin.skeleton .side .spoke:after {
background: rgba(204, 204, 255, 0.2);
}
body {
background-color: #000;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
@-webkit-keyframes spin {
from {
-webkit-transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(360deg);
}
}
.coin .front {
background-image: url(http://localhost:63342/workspace/practice/2020-01-02-red_envelopes/3112/images/2.jpg);
/*background-image: url(../images/money@2x.png);*/
}
.coin .back {
background-image: url(http://localhost:63342/workspace/practice/2020-01-02-red_envelopes/3112/images/1.jpg);
/*background-image: url(../images/money@2x.png);*/
}
</style>
</head>
<body>
<!-- The Coin -->
<div class="purse">
<div class="coin">
<div class="front"></div>
<div class="back"></div>
<div class="side">
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
<div class="spoke"></div>
</div>
</div>
</div>
<div style="margin:20px auto; text-align:center">
<!--<a href="http://www.100sucai.com/"><img src="100sucai.png"/></a>-->
</div>
</body>
</html>