|
|

楼主 |
发表于 2025-11-14 12:44
|
显示全部楼层
帖子代码
- <style>
- @import 'https://638183.freep.cn/638183/web/tz/tz.min.css';
- .pa { --offsetX: 0px; --bg: url('https://638183.freep.cn/638183/t24/w7/glw.webp') no-repeat center/cover; }
- .star { position: absolute; width: 4px; height: 4px; background: lightblue; animation: flash 2s infinite alternate var(--state); }
- .ball { position: absolute; width: 40px; height: 40px; background: linear-gradient(tan, var(--bg)); border-radius: 50%; animation: hue-rot linear .5s infinite alternate var(--state), rot linear 4s infinite var(--state); cursor: pointer; }
- @keyframes flash { to { opacity: 0; transform: rotate(var(--deg)); } }
- @keyframes hue-rot { to { filter: hue-rotate(200deg); } }
- </style>
- <div id="pa" class="pa"></div>
- <script type="module">
- import TZ from 'https://638183.freep.cn/638183/web/tz/tz.v3.js';
- const tz = TZ.TZ('pa');
- tz.add('audio', '', '', { src: 'https://music.163.com/song/media/outer/url?id=2687791808' });
- Array.from({length: 100}).forEach( (_, key) => {
- const x = tz.ranPos(pa.offsetWidth);
- const y = tz.ranPos(pa.offsetHeight / 3);
- tz.add('div', '', 'star', { style: `
- left: ${100 * x / pa.offsetWidth}%;
- top: ${100 * y / pa.offsetHeight}%;
- animation-duration: ${1 + tz.getRanInt(1,0)}s;
- animation-delay: ${tz.getRanInt(-2,0)}s;
- --deg: ${tz.getRanInt(50, 160)}deg;
- `});
- });
-
- const points = tz.ringPos(10, {
- cx: pa.offsetWidth / 2,
- cy: pa.offsetHeight / 3,
- r1: pa.offsetWidth / 4,
- r2: pa.offsetHeight / 4,
- a: -180,
- });
-
- points.forEach(point => {
- tz.add('div', '', 'ball', {style: `
- left: ${100 * point[0] / pa.offsetWidth}%;
- top: ${100 * point[1] / pa.offsetHeight}%;
- --bg: ${tz.color16()};
- `}).playmp3();
- });
-
- tz.fs().style('left: 20px; bottom: 20px');
- </script>
复制代码
|
|