是通过添加伪元素的方式,比那个移动z轴的好点,没有阴影存在,但是有抖动

    1. <!DOCTYPE html>
    2. <html >
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>GBP</title>
    6. <style>
    7. /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */
    8. .purse {
    9. height: 160px;
    10. width: 160px;
    11. position: absolute;
    12. top: 50%;
    13. left: 50%;
    14. margin-top: -80px;
    15. margin-left: -80px;
    16. -webkit-perspective: 1000;
    17. -webkit-box-reflect: below 0 linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.2));
    18. -webkit-filter: saturate(1.45) hue-rotate(2deg);
    19. }
    20. .coin {
    21. height: 160px;
    22. width: 160px;
    23. position: absolute;
    24. -webkit-transform-style: preserve-3d;
    25. -webkit-transform-origin: 50%;
    26. -webkit-animation: spin 2s infinite;
    27. -webkit-animation-timing-function: linear;
    28. }
    29. .coin .front,
    30. .coin .back {
    31. position: absolute;
    32. height: 160px;
    33. width: 160px;
    34. border-radius: 50%;
    35. background-size: cover;
    36. }
    37. .coin .front {
    38. -webkit-transform: translateZ(8px);
    39. }
    40. .coin .back {
    41. -webkit-transform: translateZ(-8px) rotateY(180deg);
    42. }
    43. .coin .side {
    44. -webkit-transform: translateX(72px);
    45. -webkit-transform-style: preserve-3d;
    46. -webkit-backface-visibility: hidden;
    47. }
    48. .coin .side .spoke {
    49. height: 160px;
    50. width: 16px;
    51. position: absolute;
    52. -webkit-transform-style: preserve-3d;
    53. -webkit-backface-visibility: hidden;
    54. }
    55. .coin .side .spoke:before,
    56. .coin .side .spoke:after {
    57. content: '';
    58. display: block;
    59. height: 15.68274245px;
    60. width: 16px;
    61. position: absolute;
    62. -webkit-transform: rotateX(84.375deg);
    63. background: #d8be83;
    64. background: linear-gradient(to bottom, #e6cf99 0%, #e6cf99 74%, #c2a970 75%, #c2a970 100%);
    65. background-size: 100% 3.48505388px;
    66. }
    67. .coin .side .spoke:before {
    68. -webkit-transform-origin: top center;
    69. }
    70. .coin .side .spoke:after {
    71. bottom: 0;
    72. -webkit-transform-origin: center bottom;
    73. }
    74. .coin .side .spoke:nth-child(16) {
    75. -webkit-transform: rotateY(90deg) rotateX(180deg);
    76. }
    77. .coin .side .spoke:nth-child(15) {
    78. -webkit-transform: rotateY(90deg) rotateX(168.75deg);
    79. }
    80. .coin .side .spoke:nth-child(14) {
    81. -webkit-transform: rotateY(90deg) rotateX(157.5deg);
    82. }
    83. .coin .side .spoke:nth-child(13) {
    84. -webkit-transform: rotateY(90deg) rotateX(146.25deg);
    85. }
    86. .coin .side .spoke:nth-child(12) {
    87. -webkit-transform: rotateY(90deg) rotateX(135deg);
    88. }
    89. .coin .side .spoke:nth-child(11) {
    90. -webkit-transform: rotateY(90deg) rotateX(123.75deg);
    91. }
    92. .coin .side .spoke:nth-child(10) {
    93. -webkit-transform: rotateY(90deg) rotateX(112.5deg);
    94. }
    95. .coin .side .spoke:nth-child(9) {
    96. -webkit-transform: rotateY(90deg) rotateX(101.25deg);
    97. }
    98. .coin .side .spoke:nth-child(8) {
    99. -webkit-transform: rotateY(90deg) rotateX(90deg);
    100. }
    101. .coin .side .spoke:nth-child(7) {
    102. -webkit-transform: rotateY(90deg) rotateX(78.75deg);
    103. }
    104. .coin .side .spoke:nth-child(6) {
    105. -webkit-transform: rotateY(90deg) rotateX(67.5deg);
    106. }
    107. .coin .side .spoke:nth-child(5) {
    108. -webkit-transform: rotateY(90deg) rotateX(56.25deg);
    109. }
    110. .coin .side .spoke:nth-child(4) {
    111. -webkit-transform: rotateY(90deg) rotateX(45deg);
    112. }
    113. .coin .side .spoke:nth-child(3) {
    114. -webkit-transform: rotateY(90deg) rotateX(33.75deg);
    115. }
    116. .coin .side .spoke:nth-child(2) {
    117. -webkit-transform: rotateY(90deg) rotateX(22.5deg);
    118. }
    119. .coin .side .spoke:nth-child(1) {
    120. -webkit-transform: rotateY(90deg) rotateX(11.25deg);
    121. }
    122. .coin.skeleton .front,
    123. .coin.skeleton .back {
    124. display: none;
    125. }
    126. .coin.skeleton .side,
    127. .coin.skeleton .side .spoke,
    128. .coin.skeleton .side .spoke:before,
    129. .coin.skeleton .side .spoke:after {
    130. -webkit-backface-visibility: visible;
    131. }
    132. .coin.skeleton .side .spoke {
    133. background: rgba(170, 170, 170, 0.1);
    134. }
    135. .coin.skeleton .side .spoke:before {
    136. background: rgba(255, 170, 170, 0.2);
    137. }
    138. .coin.skeleton .side .spoke:after {
    139. background: rgba(204, 204, 255, 0.2);
    140. }
    141. body {
    142. background-color: #000;
    143. position: absolute;
    144. top: 0;
    145. bottom: 0;
    146. left: 0;
    147. right: 0;
    148. }
    149. @-webkit-keyframes spin {
    150. from {
    151. -webkit-transform: rotateY(0deg);
    152. }
    153. to {
    154. -webkit-transform: rotateY(360deg);
    155. }
    156. }
    157. .coin .front {
    158. background-image: url(http://localhost:63342/workspace/practice/2020-01-02-red_envelopes/3112/images/2.jpg);
    159. /*background-image: url(../images/money@2x.png);*/
    160. }
    161. .coin .back {
    162. background-image: url(http://localhost:63342/workspace/practice/2020-01-02-red_envelopes/3112/images/1.jpg);
    163. /*background-image: url(../images/money@2x.png);*/
    164. }
    165. </style>
    166. </head>
    167. <body>
    168. <!-- The Coin -->
    169. <div class="purse">
    170. <div class="coin">
    171. <div class="front"></div>
    172. <div class="back"></div>
    173. <div class="side">
    174. <div class="spoke"></div>
    175. <div class="spoke"></div>
    176. <div class="spoke"></div>
    177. <div class="spoke"></div>
    178. <div class="spoke"></div>
    179. <div class="spoke"></div>
    180. <div class="spoke"></div>
    181. <div class="spoke"></div>
    182. <div class="spoke"></div>
    183. <div class="spoke"></div>
    184. <div class="spoke"></div>
    185. <div class="spoke"></div>
    186. <div class="spoke"></div>
    187. <div class="spoke"></div>
    188. <div class="spoke"></div>
    189. <div class="spoke"></div>
    190. </div>
    191. </div>
    192. </div>
    193. <div style="margin:20px auto; text-align:center">
    194. <!--<a href="http://www.100sucai.com/"><img src="100sucai.png"/></a>-->
    195. </div>
    196. </body>
    197. </html>