|
|

楼主 |
发表于 2025-7-22 12:38
|
显示全部楼层
参考代码
- <style>
- #papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: url('https://638183.freep.cn/638183/t24/6/syrf.jpg') no-repeat center/cover; box-shadow: 2px 2px 8px #000; z-index: 1; overflow: hidden; display: grid; place-items: center; position: relative; }
- #player { left: 35%; top: 10%; aspect-ratio: 1/1; width: 12%; transform-style: preserve-3d; animation: rot 8s linear infinite var(--state); cursor: pointer; position: absolute; }
- .ring { position: absolute; left: -50%; width: 100%; height: 100%; border: 8px dotted white; border-radius: 20px; background: url('https://638183.freep.cn/638183/small/texture/pgy.png') no-repeat center/cover; box-sizing: border-box; transform-origin: 100% 0%; transform: rotateY(var(--ay)); box-shadow: inset 0 0 36px green; transition: .7s; }
- #player:hover .ring { filter: hue-rotate(var(--ay)); }
- #btnFs { bottom: 20px; color: #eee; }
- .vid {position: absolute; width: 100%; height: 100%; object-fit: cover; mask: radial-gradient(transparent 20%, red); -webkit-mask: radial-gradient(transparent 20%, red); opacity: .45; pointer-events: none; }
- @keyframes rot {
- from { transform: rotateX(-15deg) rotateY(0deg); }
- to { transform: rotateX(-15deg) rotateY(360deg); }
- }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2716664545" autoplay loop></audio>
- <video class="vid" src="https://bpic.588ku.com/video_listen/588ku_video/22/11/05/01/27/17/video63654b75b7bfc.mp4" autoplay loop muted></video>
- <div id="player"></div>
- </div>
- <script type="module">
- import { FS } from 'https://638183.freep.cn/638183/web/js/fullscreen.js';
- FS(papa, player);
- const total = 12;
- Array.from({ length: total }).forEach( (d, k) => {
- d = document.createElement('div');
- d.className = 'ring';
- d.style.cssText += `--ay: ${k * 360 / total}deg`;
- player.appendChild(d);
- });
- </script>
复制代码 CSS中 #player:hover .ring {} 里巧妙利用 class="ring" 元素们的Y轴旋转角度即 --ay 变量值为 .ring 的 filter 滤镜 hue-rotate 色彩变换提供数据依据——旋转和色相变化均使用 deg 做单位。
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|