生命之河
本帖最后由 醉美水芙蓉 于 2023-9-24 22:37 编辑 <br /><br /><style>#papa { margin: 80px 0 0 calc(50% - 681px); width: 1200px; height: 675px;box-shadow: 3px 3px 20px #000; z-index: 1; display: grid; place-items: center; position: relative; overflow: hidden; }
#papa::before { position: absolute; content: url('https://638183.freep.cn/638183/t22/gif/bird.gif'); top: 0; }
#btnMsg { position: absolute; color: snow; background: green; opacity: 0; border: 2px solid snow; border-radius: 8px; padding: 4px; transition: all .75s; cursor: pointer; z-index: 1001; }
</style>
<div id="papa">
<video id="vid" src="https://video-js.51miz.com/preview/video/00/00/16/92/V-169278-3EA58306.mp4" autoplay="" loop="" muted="" bd_landing_video_statistic_record_key="1"></video>
<audio id="aud" src="https://shuifurong.s3-us-east-1.ossfiles.com/shengming.mp3" loop autoplay crossorigin="anonymous"></audio>
<script >
(function() {
(function(mkPlayer) {let defaults = {lrcAr: [],lrc_css: 'top: 15px; left: 50%; transform: translate(-50%)',player_css: 'bottom: 5px; left: 50%; transform: translate(-50%)',playerCode: `<style>#mplayer { --ww: 100%; --bg: linear-gradient(to top,lightgreen,green,lightgreen); margin: auto; position: absolute; width: var(--ww); height: 160px; display: flex; justify-content: center; align-items: flex-end; cursor: pointer; }.mLine { position: relative; margin: 0 1px 0 1px; width: 4px; height: 10px; background: var(--bg); }.mLine::before, .mLine::after { position: absolute; content: ''; width: 100%; height: 3px; background: snow; top: 0; }.mLine::after { top: 100%; }#lrc { --motion: cover2; --tt: 1s; --state: running; --bg: linear-gradient(180deg,hsla(100,10%,50%,.75),hsla(100,100%,20%,.65)); position: absolute; font: bold 2.4em sans-serif; color: hsl(100, 100%, 90%); white-space: pre; -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0, 100%, 0%, .85)); z-index: 900; }#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: pre; background: var(--bg); 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%; } }</style><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div id="mplayer" title="播放/暂停"></div>`,};let playCode = (user_config) => {let data = Object.assign({}, defaults, user_config);papa.innerHTML += data.playerCode;mplayer.style.cssText += data.player_css;lrc.style.cssText += data.lrc_css;let mKey = 0, mFlag = true, btfFlag = false;let total = Math.ceil(mplayer.offsetWidth / 6);for(j=0; j<total; j++) {let el = document.createElement('span');el.className = 'mLine';mplayer.appendChild(el);}let Ac = new AudioContext;let source = Ac.createMediaElementSource(aud);let analyser = Ac.createAnalyser();source.connect(analyser);analyser.connect(Ac.destination);let output = new Uint8Array(total);let ypAr = [];let lines = document.querySelectorAll('.mLine');(function update() {analyser.getByteFrequencyData(output);let mid = total % 2 === 0 ? total / 2 - 1 : Math.floor(total / 2);for(j = 0; j < total ; j++) {let k = j <= mid ? (mid - j) * 2 : (j - mid) * 2 - 1;/*lines.style.height = output/2 + 'px';*/lines.style.height = output/2+'px';lines.style.bottom = k*0.25 + 'px';}window.requestAnimationFrame(update);})();aud.addEventListener('timeupdate', () => {for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {if (mKey === j) showLrc(data.lrcAr);else continue;}}});aud.addEventListener('pause', () => mState());aud.addEventListener('play', () => mState());aud.addEventListener('seeked', () => calcKey());let mState = () => aud.paused ? (lrc.style.setProperty('--state', 'paused')) : (lrc.style.setProperty('--state', 'running'));let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = data.lrcAr;lrc.dataset.lrc = data.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 < data.lrcAr.length; j++) {if (aud.currentTime <= data.lrcAr) {mKey = j - 1;break;}}if (mKey < 0) mKey = 0;if (mKey > data.lrcAr.length - 1) mKey = data.lrcAr.length - 1;let time = data.lrcAr - (aud.currentTime - data.lrcAr);showLrc(time);};mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();};mkPlayer.HCPlayer = playCode;})(this);
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
HCPlayer({
lrcAr: lrcAr,
player_css: '--ww: 100%; bottom: 8px;left: 100px;',
lrc_css: '--bg: linear-gradient(180deg,hsla(0,100%,50%,.35),hsla(120,100%,50%,.65)); color: lightblue; top: 10px;',
});
let fs = false, timerId;
btnMsg.style.opacity = '0';
btnMsg.onclick = () => fs ? document.exitFullscreen() : papa.requestFullscreen();
papa.onmousemove = () => {
clearTimeout(timerId);
btnMsg.style.opacity = '.95';
timerId = setTimeout('btnMsg.style.opacity = "0"',3000);
};
document.addEventListener("fullscreenchange", () => {
if(document.fullscreenElement !== null) {
fs = true;
btnMsg.innerText = '退出全屏';
} else {
fs = false;
btnMsg.innerText = '全屏观赏';
}
});
})();
</script>
唯美 小文 发表于 2023-9-25 08:15
唯美
谢谢小文点评! 欣赏欣赏 问好水芙蓉,这个视频背景用的真好{:4_199:} 欣赏水芙蓉的精彩制作{:4_171:} 世外桃源 发表于 2023-9-25 12:25
欣赏欣赏
谢谢朋友支持! 小辣椒 发表于 2023-9-25 15:37
欣赏水芙蓉的精彩制作
谢谢小辣椒光临! 醉美水芙蓉 发表于 2023-9-25 16:50
谢谢朋友支持!
不客气,老师做的真漂亮 给力的制作{:4_187:} 辫子哥哥 发表于 2023-9-25 17:42
给力的制作
辫子哥哥晚上好! 漂亮。欣赏水芙蓉美女好帖{:4_199:} 红影 发表于 2023-9-26 13:54
漂亮。欣赏水芙蓉美女好帖
这个跟你学的呢! 醉美水芙蓉 发表于 2023-9-26 17:07
这个跟你学的呢!
我那视频也是网上找的,大家一起用{:4_173:} 醉美水芙蓉 发表于 2023-9-25 18:08
辫子哥哥晚上好!
中秋节快乐!
页:
[1]