芒种(学习黑师《火》双背景效果)
<style>
#papa {
margin: 0 0 0 calc(50% - 593px);
width: 1024px;
height: 593px;
background:
url('https://s1.ax1x.com/2023/05/18/p9fQLjI.jpg') no-repeat center/cover,
#000 url('https://pic2.imgdb.cn/item/644f88a60d2dde577739d9b5.gif') no-repeat center;
background-blend-mode: screen;
box-shadow: 0 0 8px #000;
position: relative;
display: grid;
place-items: center;
overflow: hidden;
--state: paused;
}
#vid {
position: absolute;
width: 1400px;
height: 100%;
border-radius: 2%;
opacity: .53;
object-fit: cover;
pointer-events: none;
mix-blend-mode: screen;
}
css-doodle { position: absolute; }
</style>
<div id="papa">
<css-doodle id="mplayer">
:doodle { @size: 80px; animation: rot 4s infinite linear var(--state); cursor: pointer; }
background: rgba(244,164,96,.9);
clip-path: @shape(
points: 18;
R: seq(.618, 1, 0);
T: seq(t-.55, t, t);
x: R * cos(T);
y: R * sin(T);
);
@keyframes rot { to { transform: rotate(1turn); } }
</css-doodle>
<css-doodle id="lrc">
:doodle {
@size: auto 4em;
bottom: 10px;
--geci: "css-doodle player"; --motion: cover2; --tt: 1s; } /* 单元格两个伪元素显示lrc歌词 */
display: grid; place-items: center start; :before, :after { content: var(--geci); color: Honeydew; /* 歌词底色 */ font: bold 2em sans-serif; text-shadow: 1px 1px 2px #000; white-space: pre; } :after { position: absolute; width: 0; color:SandyBrown; /* 同步歌词颜色 */ overflow: hidden; animation: var(--motion) var(--tt) linear forwards var(--state); } @keyframes cover1 { from { width: 0; } to { width: 100%; } } @keyframes cover2 { from { width: 0; } to { width: 100%; } } </css-doodle>
<video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/02/01/5b4eed878e310.mp4" autoplay="" loop="" muted=""></video>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1369798757" autoplay loop></audio>
</div>
<script>
let slip = 0.5, mFlag = true, mKey = 0, clickIdx = 0, progChg = 0, cursors = ['default','pointer','pointer'];
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
let calcKey = () => {for (j = 0;j < lrcAr.length;j++) {if (aud.currentTime <= lrcAr) {mKey = j - 1;break;}}if (mKey < 0) mKey = 0;if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
let script = document.createElement('script');
script.src = 'https://638183.freep.cn/638183/web/api/css-doodle.js';
document.body.appendChild(script);
let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
let showLrc = (time) => {lrc.style.setProperty('--motion', mFlag ? 'cover1' : 'cover2');lrc.style.setProperty('--geci', '"' + lrcAr + '"');lrc.style.setProperty('--tt', time + 's');mKey += 1;mFlag = !mFlag;};
aud.addEventListener('play', mState, false);
aud.addEventListener('pause', mState, false);
aud.addEventListener('timeupdate', () => {for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime - slip >= lrcAr) {cKey = j;if (mKey === j) showLrc(lrcAr);else continue;}}mplayer.style.setProperty('--ttmsg1', `'${toMin(aud.currentTime)}'`);mplayer.style.setProperty('--ttmsg2', `'${toMin(aud.duration)}'`);mplayer.style.setProperty('--prog',`${100 * aud.currentTime / aud.duration}%`);});
mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();
</script> @马黑黑 动图不设置 cover果然本身多大就多大。又学到了 厉害了,朋友!{:4_191:} 场场冠军!干脆封号“冠军王”如何。{:4_203:} 又创造性运用了,这啥节奏{:4_187:} 这个做得漂亮,选的动图也漂亮,这么快就做出了最新效果,月儿太厉害了{:4_199:} 特别喜欢的歌曲,特别喜欢的制作{:4_187:} 南无月 发表于 2023-5-18 18:18
@马黑黑 动图不设置 cover果然本身多大就多大。又学到了
{:4_190:} 欣赏美帖,收藏学习了!{:4_187:} 小文 发表于 2023-5-18 18:33
厉害了,朋友!
小文好{:4_187:}感谢回复支持 樵歌 发表于 2023-5-18 19:41
场场冠军!干脆封号“冠军王”如何。
谢谢谬赞,不敢当,学习贴而已 樵歌 发表于 2023-5-18 19:42
又创造性运用了,这啥节奏
学习代码中。。。。 红影 发表于 2023-5-18 20:26
这个做得漂亮,选的动图也漂亮,这么快就做出了最新效果,月儿太厉害了
刚好有空就套用换图,谢谢影子夸奖{:4_173:} 红影 发表于 2023-5-18 20:27
特别喜欢的歌曲,特别喜欢的制作
这首歌软绵绵温温柔柔的,哼唱一样,十分好听 马黑黑 发表于 2023-5-18 20:50
柠檬茶来一杯 醉美水芙蓉 发表于 2023-5-18 21:05
厉害!这么快!
刚好有点空就跟了一贴,跟贴快的。昨天的毛主席万岁比较慢{:4_173:} 亦是金 发表于 2023-5-18 21:25
欣赏美帖,收藏学习了!
感谢回复支持{:4_187:} 南无月 发表于 2023-5-18 22:14
柠檬茶来一杯
酸不 马黑黑 发表于 2023-5-18 22:27
酸不
维C多,每天都喝啊,我不能喝茶,这是正常饮料,没觉得