|
|

楼主 |
发表于 2024-1-14 20:37
|
显示全部楼层
本帖最后由 马黑黑 于 2024-1-14 20:42 编辑
帖子代码
- <style>
- #papa {
- margin: 0 0 0 calc(50% - 681px);
- width: 1200px;
- height: 777px;
- background: url('https://638183.freep.cn/638183/t24/webp/rebirth.webp') no-repeat center/cover;
- box-shadow: 3px 3px 20px #000;
- overflow: hidden;
- z-index: 1;
- display: grid;
- place-items: center;
- position: relative;
- }
- #player {
- position: absolute;
- width: 300px;
- height: 300px;
- cursor: pointer;
- filter: opacity(.75) hue-rotate(270deg);
- background: url('https://638183.freep.cn/638183/t24/jpg/hofghl.jpg') repeat -300px 0 / cover;
- mask: url('https://638183.freep.cn/638183/web/svg/heart.svg') no-repeat center/cover;
- -webkit-mask: url('https://638183.freep.cn/638183/web/svg/heart.svg') no-repeat center/cover;
- animation: rot 10s infinite linear var(--state), bgmov 8s infinite linear var(--state);
- }
- li-zi {
- position: absolute;
- width: 15px;
- height: 15px;
- border-radius: 50%;
- background: snow;
- opacity: .95;
- animation: moving var(--duration) var(--delay) linear infinite alternate var(--state);
- }
- @keyframes moving {
- from { transform: translate(var(--x0),var(--y0)); opacity: 1; }
- to { transform: translate(var(--x1),var(--y1)); opacity: .5; }
- }
- @keyframes rot { to { transform: rotate(1turn); } }
- @keyframes bgmov { to { background-position: 0 0; } }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1399232091" autoplay loop></audio>
- <div id="player"></div>
- </div>
- <script>
- (function() {
- let all = 60;
- for(let i = 0; i < all; i++) {
- let lz = document.createElement('li-zi');
- let hudu = Math.PI / 180 * 360 / all * i;
- let xx = 800 * Math.cos(hudu), yy = 600 * Math.sin(hudu);
- lz.style.cssText += `
- --x0: ${xx}px;
- --y0: ${yy}px;
- background: #${Math.random().toString(16).substr(-6)};
- animation: moving ${Math.random() * 20 + 20}s -${Math.random() * 20}s infinite var(--state);
- `;
- papa.prepend(lz);
- }
- let mState = () => {
- papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
- };
- aud.addEventListener('playing', mState, false);
- aud.addEventListener('pause', mState, false);
- player.onclick = () => aud.paused ? aud.play() : aud.pause();
- })();
- </script>
复制代码
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|