难却 (DJ阿卓版) - 平生不晚
本帖最后由 醉美水芙蓉 于 2023-6-11 22:23 编辑 <br /><br /><css-doodle grid="4" id="mplayer">:doodle {
@size: 1364px 909px;
background: url('https://pic.imgdb.cn/item/6485d60f1ddac507cc242669.jpg');
box-shadow: 0 0 8px #000;
display: block;
opacity: .95;
position: relative;
z-index: 1;
margin: 0 0 0 calc(50% - 793px);
--geci: 'HUACHAO';
--motion: cover2;
--ww: 300px;
--prog: 0;
--tt: 1s;
--tt1: '00:00';
--tt2: '00:00';
--xplace: 50%;
--yplace: 98%;
--color: green;
--state: paused;
}
position: absolute;
@nth(1) { /* 歌词 */
@size: auto 3em;
@place: 50% 5%;
transform: translate(-50%);
display: grid;
place-items: center start;
:before, :after {
content: var(--geci);
width: fit-content;
height: fit-content;
font: bold 2em Sans-serif;
color: #00ff00;
text-shadow: 1px 1px 2px #000;
white-space: pre;
}
:after {
position: absolute;
white-space: pre;
width: 0;
color: #00ff00;
overflow: hidden;
animation: var(--motion) var(--tt) linear forwards var(--state);
}
}
@nth(2) { /* 进度条 */
@size: var(--ww) 2px;
@place: var(--xplace) var(--yplace);
background: silver;
:before, :after { content: ''; }
:before {
position: absolute;
left: 0;
width: var(--prog);
height: 100%;
background: var(--color);
}
:after {
width: 100%;
height: 10px;
cursor: pointer;
}
}
@nth(3) { /* 按钮 */
@size: 60px;
@place: var(--xplace) calc(var(--yplace) - 36px);
cursor: pointer;
animation: rot 6s infinite linear var(--state);
:after {
content: '';
@size: inherit;
@shape: clover 4;
background: var(--color);
}
}
@nth(4) { /* 播放时间 */
@size: var(--ww) 20px;
@place: var(--xplace) calc(var(--yplace) - 20px);
:before, :after{
position: absolute;
width: 100%;
height: 100%;
color: var(--color);
}
:before { content: var(--tt1); }
:after { content: var(--tt2); text-align: right; }
}
@match(i ≥ 5) { /* 飞行物 */
@size: 200px 113px;
@place: 50px 44px;
background: url('https://pic.imgdb.cn/item/6485c9341ddac507cc0e364b.gif');
offset-path: path('M0 100 Q310 880 1600 475');
offset-distance: 0%;
animation: fly 40s calc(@r(30) * -3s) infinite linear var(--state);
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes fly { to { offset-distance: 100%; }}
</css-doodle>
<audio id="aud" src="https://www.qqmc.com/mp3/music248969537.mp3" autoplay="autoplay" loop="loop"></audio>
<script>
(function(){
let script = document.createElement('script');
script.src = 'https://638183.freep.cn/638183/web/api/css-doodle.js';
document.head.appendChild(script);
let mKey = 0, mFlag = true, slip = 0.6;
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
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 mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
let showLrc = (time) => {mplayer.style.setProperty('--motion', mFlag ? 'cover1' : 'cover2');mplayer.style.setProperty('--geci', '"' + lrcAr + '"');mplayer.style.setProperty('--tt', time + 's');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 (j = 0; j < lrcAr.length; j++) {if (aud.currentTime - slip >= lrcAr) {cKey = j;if (mKey === j) showLrc(lrcAr);else continue;}}mplayer.style.setProperty('--prog', 100*aud.currentTime/aud.duration + '%');mplayer.style.setProperty('--tt1', `'${toMin(aud.currentTime)}'`);mplayer.style.setProperty('--tt2', `'${toMin(aud.duration)}'`);});
aud.addEventListener('play', mState, false);
aud.addEventListener('pause', mState, false);
aud.addEventListener('seeked', () => calcKey());
window.onload = () => {
let btns = mplayer.shadowRoot.querySelectorAll('cell');
let ww = parseInt(window.getComputedStyle(mplayer).getPropertyValue('--ww'));
btns.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / ww;
btns.onclick = () => aud.paused ? aud.play() : aud.pause();
}
})();
</script>
这个制作真漂亮。水芙蓉美女学得真快{:4_187:} 红影 发表于 2023-6-11 22:58
这个制作真漂亮。水芙蓉美女学得真快
跟着黑黑老师学习玩玩! 醉美水芙蓉 发表于 2023-6-11 23:00
跟着黑黑老师学习玩玩!
画面非常阳光美好。播放器的颜色有点跟背景混同了呢,修改一下令它看清楚点更好{:4_187:} 学得快,做得好!{:4_187:} 学得快,做得好!{:4_187:} 樵歌 发表于 2023-6-12 10:48
学得快,做得好!
谢谢樵歌支持!
页:
[1]