|
|

楼主 |
发表于 2024-7-1 08:01
|
显示全部楼层
本帖最后由 马黑黑 于 2024-7-1 08:06 编辑
帖子代码- <style>
- #papa { --width: 1024px; margin: 30px 0 30px calc(50% - (var(--width) / 2 + 81px)); width: var(--width); height: 683px; background: url('https://638183.freep.cn/638183/t24/3/xyfg.jpg') no-repeat center/cover; z-index: 1; overflow: hidden; box-shadow: 3px 3px 8px #666; position: relative; }
- #player { position: absolute; left: calc(50% - 50px); bottom: 100px; width: 100px; height: 100px; background: linear-gradient(green,lightgreen) repeat-y center/5% 5%, linear-gradient(to right,green,lightgreen) repeat-x center/5% 5%; border: thick double; border-color: green lightgreen; border-radius: 50%; cursor: pointer; animation: rot 6s linear infinite var(--state); }
- #player:hover { transform: scale(1.2); filter: drop-shadow(0 50px 0 green); }
- #player::before, #player::after { position: absolute; content: ''; }
- #player::before { inset: 0; background: inherit; transform: rotate(45deg); }
- #player::after { inset: 40px; background: green; border-radius: 50%; }
- .vid { position: absolute; width: 100%; height: 50%; object-fit: cover; pointer-events: none; }
- .vid:nth-of-type(1) { bottom: 0; mix-blend-mode: screen; }
- .vid:nth-of-type(2) { height: 25%; top: 0; mix-blend-mode: multiply; }
- #papa:fullscreen .vid:nth-of-type(1) { height: 38%; }
- @keyframes rot { to { transform: rotate(360deg); } }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=29378862" autoplay loop></audio>
- <video class="vid" src="https://img.tukuppt.com/video_show/7165162/00/19/89/5f17a860d9235.mp4" autoplay loop muted></video>
- <video class="vid" src="https://img.tukuppt.com/video_show/2269348/00/17/44/5ec49820da8aa.mp4" autoplay loop muted></video>
- <div id="player" titel="播放/暂停"></div>
- </div>
- <script>
- var vids = papa.querySelectorAll('.vid');
- var sF = document.createElement('script');
- sF.src = 'https://638183.freep.cn/638183/web/api/fullscreen.js';
- sF.charset = 'utf-8';
- document.querySelector('body').appendChild(sF);
- sF.onload = () => FS({
- papa: '#papa',
- css: 'bottom: 20px; left: 50%; transform: translate(-50%); --color: lightblue; --fsBg: green;',
- });
- var mState = () => {
- player.style.setProperty('--state',['running','paused'][+aud.paused]);
- player.title = ['暂停','播放'][+aud.paused];
- vids.forEach(vid => aud.paused ? vid.pause() : vid.play());
- };
- aud.oncanplay = aud.onplaying = aud.onpause = () => mState();
- player.onclick = () => aud.paused ? aud.play() : aud.pause();
- </script>
复制代码 本帖:播放器使用单元素+俩伪元素做成,其中,主元素设为双线边框、圆形。中心的绿色小圆是伪元素 ::after。其他内部图案有主元素和::before的渐变背景+伪元素::after旋转45度营造出来。
|
评分
-
| 参与人数 2 | 威望 +80 |
金钱 +160 |
经验 +80 |
收起
理由
|
南无月
| + 30 |
+ 60 |
+ 30 |
很给力! |
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|