|
|

楼主 |
发表于 2022-4-10 09:13
|
显示全部楼层
本帖最后由 马黑黑 于 2022-4-10 10:44 编辑
406代碼:
- <style>
- .body { perspective: 1000px; }
- .stage {
- --len: 100px;
- margin: 80px auto 0;
- position: relative;
- width: var(--len);
- height: var(--len);
- transform-style: preserve-3d;
- animation: rot 15s linear infinite;
- }
- .stage div {
- position: absolute;
- width: inherit;
- height: inherit;
- color: #eee;
- text-shadow: 1px 1px 3px #111;
- font: 2em / var(--len) Arial;
- text-align: center;
- left: 0; top: 0;
- opacity: .8;
- }
- @keyframes rot {
- from { transform: rotateY(0deg); }
- to { transform: rotateY(-360deg); }
- }
- </style>
- <div class="stage"></div>
- <script>
- let stage = document.querySelector(".stage");
- let txt = "花潮論壇歡迎您";
- let angle = 360 / txt.length;
- let w = stage.clientWidth;
- let trz = Math.ceil(Math.tan(Math.PI / 180 * (180 - angle) /2 ) *w / 2);
- let str = "";
- for(j=0; j<txt.length; j++){
- let cc = `#${Math.random().toString(16).substr(-6)}`;
- let ry = Math.floor(j*angle);
- str += `<div style="transform:rotateY(${ry}deg) translateZ(${trz}px); background: ${cc};">${txt.charAt(j)}</div>\n`;
- }
- stage.innerHTML = str;
- </script>
复制代码
|
|