三月的阳光 发表于 2023-7-31 19:06

《走在强军征途上》致八一建军节

本帖最后由 三月的阳光 于 2023-7-31 19:24 编辑 <br /><br /><style>
#papa { margin: 0 0 0 calc(50% - 681px); width: 1200px; height: 675px; box-shadow: 3px 3px 20px #000; position: relative; z-index: 1; display: grid; place-items: center; background: url('https://s1.ax1x.com/2023/07/30/pPpVUmD.jpg') no-repeat center/cover;}
.vid { position: absolute; width: 1200px; height: 675px; object-fit: cover; }
#prog { position: absolute; bottom: 20px;left: calc(50% - 200px); width: 400px; height: 8px; border: 1px solid lightblue; border-radius: 10px;background: linear-gradient(to right, green, red var(--prg), #ffb61e 0); color: red; --prg: 0%; --state: paused; }
#prog::before, #prog::after { position: absolute; top: -30px; }
#prog::before { content: attr(data-cu); left: 0; }
#prog::after { right: 0; content: attr(data-du); }
#btnplay { position: absolute; top: -70px; left: calc(50% - 30px); width: 60px; height: 60px; background: url('https://img.wyc520.com.cn/data/attachment/forum/202307/31/184441pnaknhwa4rkea42t.png') no-repeat center/cover; cursor: pointer; animation: rot 6s infinite linear var(--state); }
#pic { position: absolute; right: -25px; top: 6px; width: 250px; height: 105px; }
#pic1 { position: absolute; left: 5px; bottom: 12px; width: 200px; height: 200px; opacity: 0.8; }
#pic2 { position: absolute; left: 15px; bottom: 210px; width: 100px; height: 67px; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; left: 50%; transform: translate(-50%); top: 26px; font: bold 2.6em sans-serif; color: hsl(300, 100%, 100%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0, 0%, 0%, .95)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: pre; background: linear-gradient(180deg, hsla(60, 100%, 50%, .45), hsla(0, 100%, 66%, .6), hsla(60, 100%, 50%, .75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
</style>

<div id="papa">
<video class="vid" src="https://img.tukuppt.com/video_show/8321488/00/19/02/5ef9e2a818c6e.mp4" autoplay="autoplay" loop="loop" muted="muted"></video>
<img id="pic" src="https://img.wyc520.com.cn/data/attachment/forum/202307/31/183728yzo7oos72zd11moo.png" alt="" />
<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
    <div id="prog" data-cu="00:00" data-du="00:00" title="调节进度">
      <span id="btnplay" title="播放/暂停"></span>
    </div>
</div>
<audio id="aud" src="http://music.163.com/song/media/outer/url?id=1298736290.mp3" autoplay loop></audio>

<script>
let toMin = (val)=> {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60), sec = parseFloat(val % 60);if(min < 10) min = '0' + min;if(sec < 10) sec = '0' + sec;return min + ':' + sec;}
let vid = document.querySelector('.vid');
let mState = () => aud.paused ? (lrc.style.setProperty('--state', 'paused'),prog.style.setProperty('--state', 'paused'), vid.pause()) : (lrc.style.setProperty('--state', 'running'),prog.style.setProperty('--state', 'running'), vid.play());
aud.addEventListener('pause', mState, false);
aud.addEventListener('play', mState, false);
aud.addEventListener('timeupdate', () => {
      prog.style.setProperty('--prg', aud.currentTime / aud.duration * 100 + '%');
      prog.dataset.cu = toMin(aud.currentTime);
      prog.dataset.du = toMin(aud.duration);
});
let mKey = 0, mFlag = true;
let lrcAr = [
['5.18', '《走在强军征途上》',4.59],
['10.02', '大海扬碧波 高山挺巍峨',3.72],
['13.94', '我们的步伐气壮山河',4.00],
['18.14', '同一心声 同一脉搏',3.77],
['22.11', '我们的方阵钢铁的组合',4.99],
['27.36', '肩负神圣重托',3.87],
['31.44', '手中钢枪紧握',3.87],
['35.51', '捍卫伟大的祖国',3.28],
['38.96', '何惧赴汤蹈火',4.24],
['43.43', '编辑:三月的阳光',7.87],
['51.71', '军歌多嘹亮 军旗红似火',3.77],
['55.68', '我们的队伍气势磅礴',3.92],
['59.81', '热爱人民 报效祖国',3.80],
['63.80', '听从党指挥 时刻准备着',4.91],
['68.98', '三军运筹帷幄 长城牢不可破',7.69],
['77.07', '走在强军征途上',3.28],
['80.52', '前程波澜壮阔',4.49],
['85.25', '走在强军征途上',3.37],
['88.80', '前程波澜壮阔',4.5]

];
      let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = lrcAr.replace(/<br>/, '\n');lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
      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);};
      aud.addEventListener('timeupdate', () => {for(let j = 0; j < lrcAr.length; j ++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);else continue;}}});
      aud.addEventListener('pause', () => mState());
      aud.addEventListener('play', () => mState());
      aud.addEventListener('seeked', () => calcKey());
btnplay.onclick = (e) => { e.stopPropagation(); aud.paused ? aud.play() : aud.pause(); }
prog.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / prog.offsetWidth;
</script>

三月的阳光 发表于 2023-7-31 19:07

同步学习影子妹妹《胜战之问》~~{:4_190:}

醉美水芙蓉 发表于 2023-7-31 20:18

路人甲 发表于 2023-7-31 20:49

向军人们致敬!

红影 发表于 2023-7-31 21:07

这个帖子很英勇雄壮,歌颂了军人们的英勇付出。制作很赞{:4_199:}
借阳光哥哥好帖,同祝所有军人们八一建军节快乐{:4_177:}

红影 发表于 2023-7-31 21:08

《走在强军征途上》,构筑坚固的钢铁长城{:4_199:}

千羽 发表于 2023-7-31 21:32

气势磅礴,提升正能量的精美制作,三月风棒棒哒{:4_187:}

梦缘 发表于 2023-8-1 10:46

致八一建军节,感谢老师的精彩分享!{:4_204:}
页: [1]
查看完整版本: 《走在强军征途上》致八一建军节