|
|

楼主 |
发表于 2024-6-7 13:56
|
显示全部楼层
代码
- <style>
- #mydiv {
- margin: auto;
- width: 760px;
- height:300px;
- border: 1px solid gray;
- position: relative;
- }
- txt-box {
- position: absolute;
- display: grid;
- place-items: center;
- left: var(--xx);
- top: 10px;
- width: 50px;
- height: 50px;
- font: normal 30px sans-serif;
- transition: .5s;
- animation: move 5s var(--delay) linear infinite alternate;
- }
- txt-box::after {
- position: absolute;
- content: '';
- inset: -6px;
- border: thick groove gold;
- border-radius: 20% 60%;
- animation: rot 5s var(--delay) linear infinite alternate;
- }
- txt-box:hover {
- filter: invert(100%) drop-shadow(0 -10px 30px black);
- }
- @keyframes move { to { top: 240px; } }
- @keyframes rot { to { transform: perspective(1000px) rotateY(60deg) rotateZ(360deg); } }
- </style>
- <div id="mydiv"></div>
- <script>
- (function() {
- const ar = '明月出天山苍茫云海间'.split('');
- const total = ar.length, half = Math.floor(ar.length / 2), ww = 700;
- let tbAr = [];
- ar.forEach((t,k) => {
- let tbox = document.createElement('txt-box');
- tbox.textContent = t;
- tbox.style.cssText += `
- --xx: ${ww / total * k + 40}px;
- --delay: -${k <= half ? k * 0.5 : (total - k) * 0.5}s;
- `;
- mydiv.appendChild(tbox);
- });
- })();
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +100 |
金钱 +200 |
经验 +100 |
收起
理由
|
小辣椒
| + 50 |
+ 100 |
+ 50 |
赞一个! |
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|