- UID
- 588
- 主题
- 回帖
- 0
- 精华
- 积分
- 698
- 金币
- 枚
- 草籽
- 颗
- 鲜花
- 朵
- 注册时间
- 2023-10-3
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2024-6-17 13:14
|
显示全部楼层
本帖最后由 司敏儿 于 2024-6-17 13:43 编辑
- <style>
- #tz { margin: 30px auto; width: 1024px; height: 640px; overflow: hidden; display: grid; place-items: center; position: relative; }
- #tz::before { position: absolute; content: ''; width: var(--size); height: var(--size); background: linear-gradient(cyan, olive, orange, navy); animation: spin 12s linear infinite var(--state); }
- #nr { position: absolute; padding: 10px; background: url('https://638183.freep.cn/638183/t24/2/dahe.jpg') no-repeat center/cover; inset: 6px; }
- txt-box { position: absolute; display: grid; place-items: center; left: var(--xx); bottom: 0; width: 50px; height: 50px; font: normal 30px sans-serif; color: white; transition: .5s; cursor: pointer; animation: move 5s var(--delay) linear infinite alternate var(--state); }
- txt-box::after { position: absolute; content: ''; inset: -6px; border: thick groove olive; border-radius: 50%; box-shadow: inset 0 0 30px lightblue; transform: perspective(1000px) rotateY(-60deg) rotateZ(0); animation: rot 5s var(--delay) linear infinite alternate var(--state); }
- txt-box:hover { filter: hue-rotate(60deg) drop-shadow(0 -10px 30px white); }
- #vid { position: absolute; left: 0; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: darken; pointer-events: none; }
- #bird { position: absolute; left: 1024px; top: -70px; mix-blend-mode: multiply; animation: fly linear 6s infinite var(--state); }
- @keyframes move { to { bottom: 150px; } }
- @keyframes rot { to { transform: perspective(1000px) rotateY(60deg) rotateZ(360deg); } }
- @keyframes spin { to { transform: rotate(360deg); } }
- @keyframes fly { to { left: -400px; } }
- </style>
- <div id="tz">
- <div id="nr" data-tt="大河悠久">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=4904991" autoplay loop></audio>
- <video id="vid" src="https://img.tukuppt.com/video_show/2418175/01/32/44/62dde814a8a83.mp4" muted autoplay loop disablePictureInPichture></video>
- <img id="bird" alt="" src="https://638183.freep.cn/638183/small/flybirds.gif" />
- </div>
- </div>
- <script>
- (function() {
- tz.style.setProperty('--size', Math.ceil(Math.sqrt(tz.offsetWidth ** 2 + tz.offsetHeight ** 2)) + 'px');
- const ar = nr.dataset.tt.split('');
- const total = ar.length, half = Math.floor(ar.length / 2);
- let tbAr = [];
- ar.forEach((t,k) => {
- let tbox = document.createElement('txt-box');
- tbox.textContent = t;
- tbox.style.cssText += `
- --xx: ${100 * k + 50}px;
- --delay: -${k <= half ? k * 0.5 : (total - k) * 0.5}s;
- `;
- tbAr.push(tbox);
- nr.appendChild(tbox);
- });
- aud.onplaying = aud.onpause = () => {
- tz.style.setProperty('--state', ['running','paused'][+aud.paused]);
- aud.paused ? vid.pause() : vid.play();
- tbAr.forEach(item => item.title = ['暂停','播放'][+aud.paused]);
- };
- tbAr.forEach(item => item.onclick = () => aud.paused ? aud.play() : aud.pause());
- })();
- </script>
复制代码 |
|