雨中悄然 发表于 2023-2-1 18:19

【大草原】学习黑黑 舞毕播放器 作业贴

本帖最后由 雨中悄然 于 2023-2-3 18:52 编辑 <br /><br /><table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_1790851">
<style>
#papa { left: calc(50% - 81px); transform: translateX(-50%); width: 1200px; height: 740px; background: tan url('https://s1.ax1x.com/2023/02/01/pSDk2oq.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; top:100px; display: grid; place-items: center; overflow: hidden; user-select: none; z-index: 1; }

.ship { position: absolute; width: 1600px; height: 900px; object-fit: cover; opacity: .55; clip-path: circle(90% at bottom) ;mix-blend-mode: screen;}
#dt1{ position: absolute; width: 459px; height: 241px; top: 382px; left: 810px; }
#dt2{ position: absolute; width: 120px; height: 71px; top: 550px; left: 450px; }
@keyframes rot1 { to { transform: rotate(5deg); } }

@keyframes rot2 { from { transform: rotate(-15deg) scale(1); } to { transform: rotate(15deg) scale(1.5); } }
@keyframes opa { from { opacity: 0; } to { opacity: .55; } }
</style>
<div id="papa">
<video class="ship"
src="https://img.tukuppt.com/video_show/2269348/00/14/64/5e593f4b8ab37.mp4" autoplay="autoplay" loop="loop" muted="muted"></video>

        <audio id="aud" src="https://music.163.com/song/media/outer/url?id=322017.mp3" loop autoplay></audio>

<script >
(function() {
        (function(mkPlayer) {let defaults = {lrcAr: [,],ttAr: ['花潮','论坛','LRC','在线'],lrc_css: 'top: 20px; left: 50%; transform: translateX(-50%);',player_css: 'bottom: 20px; left: calc(50% - 50px);', playerCode: `<style>#mplayer {--bg: linear-gradient(to right bottom,olive,black);position: absolute;width: 100px;height: 100px;display: grid;place-items: center;animation: rot 10s infinite linear;cursor: pointer;color: snow;transform-style: preserve-3d;}.pedal {position: absolute;width: 120px;height: 50px;background: var(--bg);font: bold 2em sans-serif;display: grid;place-items: center;opacity: .95;}.pedal:nth-of-type(1) { transform: rotateY(45deg) translateZ(50px); }.pedal:nth-of-type(2) { transform: rotateY(135deg) translateZ(50px); }.pedal:nth-of-type(3) { transform: rotateY(-135deg) translateZ(50px); }.pedal:nth-of-type(4) { transform: rotateY(-45deg) translateZ(50px); }#btnMsg { position: absolute; color: snow; background: #666; opacity: 0; border: 2px solid snow; border-radius: 8px; padding: 4px; transition: all .75s; cursor: pointer; z-index: 901; }#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 rot { to { transform: rotateY(-1turn); } }@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"><span class="pedal"></span><span class="pedal"></span><span class="pedal"></span><span class="pedal"></span></div><span id="btnMsg">全屏观赏</span>`,};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, fs = false, tnow = Date.now(), timerId;;data.ttAr.forEach( (item,key) => {let spans = mplayer.children;spans.innerText =item;});mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();btnMsg.onclick = () => fs ? document.exitFullscreen() : papa.requestFullscreen();papa.onmousemove = (e) => {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 = '全屏观赏';}});aud.addEventListener('pause', () => mState());aud.addEventListener('play', () => mState());aud.addEventListener('seeked', () => calcKey());let mState = () => aud.paused ? (lrc.style.setProperty('--state','paused'), mplayer.style.animationPlayState='paused') : (lrc.style.setProperty('--state','running'), mplayer.style.animationPlayState='running');aud.addEventListener('timeupdate', () => {for (j = 0; j < data.lrcAr.length; j++) {if (aud.currentTime >= data.lrcAr) {if (mKey === j) showLrc(data.lrcAr);else continue;}}});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);};};mkPlayer.HCPlayer = playCode;})(this);
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
        HCPlayer({
                lrcAr: lrcAr,
                lrc_css: '--bg: linear-gradient(hsla(180,80%,60%,.7),hsla(220,70%,40%,.5)); top: 670px;',
                ttAr: ['花潮','黑黑','播放','草原'],
                player_css: '--bg: repeating-linear-gradient(90deg, transparent, SeaGreen 8px, silver 16px); top: 5px; left:1000px;color: lightblue;',
        });
})();
</script>
<br></div><br><br><br><br><br><br><br><br><br></td></tr></table>

雨中悄然 发表于 2023-2-1 18:22

感觉1200*740大小还是比较合适我{:4_173:}@马黑黑

雨中悄然 发表于 2023-2-1 18:22

原来播放器高度大小应该都可以更改的{:5_117:}又学到了

红影 发表于 2023-2-1 21:15

这制作又是一种风格,像彩铅?我不太懂,只是觉得很好看。悄然真是让人惊喜连连{:4_199:}

红影 发表于 2023-2-1 21:15

播放器也调整得很好,大小色彩和位置正好适合。悄然聪颖{:4_187:}

红影 发表于 2023-2-1 21:28

动态也用得好美,歌词同步的开始也很准确,貌似没使用微调?有几句同步的结束太快或太慢{:4_173:}

马黑黑 发表于 2023-2-1 21:47

雨中悄然 发表于 2023-2-1 18:22
感觉1200*740大小还是比较合适我@马黑黑

你要考虑手机用户,1024*560可能比较理想

马黑黑 发表于 2023-2-1 21:48

空濛中有点意思

马黑黑 发表于 2023-2-1 22:04

雨中悄然 发表于 2023-2-1 18:22
原来播放器高度大小应该都可以更改的又学到了

能改的东西应该不少的

醉美水芙蓉 发表于 2023-2-1 22:21

庶民来了 发表于 2023-2-2 05:47

都这样有才,制作美。

海笑 发表于 2023-2-2 09:56

欣赏老师佳作!

小辣椒 发表于 2023-2-2 12:47

雨中悄然 发表于 2023-2-1 18:22
原来播放器高度大小应该都可以更改的又学到了

悄然会改播放器渐变了,尺寸也是修改了,又进一大步了{:4_199:}

小辣椒 发表于 2023-2-2 12:48

悄然加油~~~再接再厉{:4_178:}

雨中悄然 发表于 2023-2-2 14:55

红影 发表于 2023-2-1 21:15
这制作又是一种风格,像彩铅?我不太懂,只是觉得很好看。悄然真是让人惊喜连连

你是真厉害,这个是彩铅效果{:4_173:}很多年没做图,真的手生,只能凑和看

雨中悄然 发表于 2023-2-2 14:56

红影 发表于 2023-2-1 21:15
播放器也调整得很好,大小色彩和位置正好适合。悄然聪颖

黑老师说明写得细致,教的真的好{:4_173:}

雨中悄然 发表于 2023-2-2 14:57

红影 发表于 2023-2-1 21:28
动态也用得好美,歌词同步的开始也很准确,貌似没使用微调?有几句同步的结束太快或太慢

没有用过微调,还不知道怎么用。等有空的时候研究一下,把它整清楚了。{:4_187:}

雨中悄然 发表于 2023-2-2 14:59

马黑黑 发表于 2023-2-1 21:47
你要考虑手机用户,1024*560可能比较理想

这个图片没上传上聚合,换了一个网站传。我的手机可以看到自己做的贴子了,是宽了一丢丢
实际上之前我自己做的贴子除了周演专辑和星空,其他的图我手机都看不到,所以根本不知道手机效果{:4_173:}

雨中悄然 发表于 2023-2-2 15:00

马黑黑 发表于 2023-2-1 21:48
空濛中有点意思

凑和{:4_170:}

雨中悄然 发表于 2023-2-2 15:01

马黑黑 发表于 2023-2-1 22:04
能改的东西应该不少的

的确有些感觉了,一点点摸索中{:4_187:}
页: [1] 2 3 4
查看完整版本: 【大草原】学习黑黑 舞毕播放器 作业贴