|
|

楼主 |
发表于 2023-4-4 12:43
|
显示全部楼层
参考代码
- <style>
- #wrap {
- margin: 50px auto;
- width: 240px;
- height: 240px;
- border: 1px solid gray;
- cursor: pointer;
- position: relative;
- }
- #wrap::before {
- position: absolute;
- content: '';
- width: 200px;
- height: 8px;
- border-radius: 50% 0 0 50%;
- background: linear-gradient(to right,tan,black);
- right: 0;
- transform-origin: 100% 50%;
- transform: rotate(-5deg);
- z-index: 10;
- animation: var(--chg);
- }
- #pan {
- width: 200px;
- height: 200px;
- border-radius: 50%;
- background: linear-gradient(30deg, transparent 40%, rgba(42, 41, 40, .85) 40%) no-repeat 100% 0, linear-gradient(60deg, rgba(42, 41, 40, .85) 60%, transparent 60%) no-repeat 0 100%, repeating-radial-gradient(#2a2928, #2a2928 4px, #ada9a0 5px, #2a2928 6px);
- background-size: 50% 100%, 100% 50%, 100% 100%;
- bottom: 0;
- position: absolute;
- animation: var(--rot);
- }
- #pan::before {
- position: absolute;
- content: '';
- top: 50%; left: 50%;
- margin: -35px;
- border: solid 1px #d9a388;
- width: 68px; height: 68px;
- border-radius: 50%;
- box-shadow: 0 0 0 4px #da5b33, inset 0 0 0 27px #da5b33;
- background: #b5ac9a;
- }
- @keyframes chgAngle {
- from { transform: rotate(-16deg); }
- to { transform: rotate(-32deg); }
- }
- @keyframes rotate { to { transform: rotate(4turn); } }
- </style>
- <div id="wrap" title="点击运行">
- <div id="pan"></div>
- </div>
- <script>
- wrap.onclick = () => {
- pan.style.setProperty('--rot','');
- wrap.style.setProperty('--chg','');
- setTimeout( () => {
- pan.style.setProperty('--rot','rotate 10s linear backwards');
- wrap.style.setProperty('--chg','chgAngle 10s linear backwards');
- },10);
- }
- </script>
复制代码
|
|