You Lay Down
<style>#papa { left: -214px; width: 1024px; height: 640px; background: #ccc url('https://638183.freep.cn/638183/qd/layudown.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 0; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, red, green); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center;transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid tan; border-radius: 6px; opacity: .25; }
#btnplay { width: 20px; height: 20px; background: #eee; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, black, blue 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: olive; opacity: .75; }
#lrc { position: absolute; top: 15px; font: bold 2em sans-serif; color: transparent; background: linear-gradient(-90deg, tomato, snow) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
#birds {position: absolute;left: 0;top: 0;width: 200px;offset-distance: 0;offset-path: path("M1100 50 H200 L-100 -50");animation: move 12s linear infinite;}
@keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes move { to { offset-distance: 100%;} }
</style>
<div id="papa">
<img id="birds" src="https://638183.freep.cn/638183/qd/rini.png" alt="" />
<div id="lrc">花潮lrc在线</div>
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
</div>
<script>
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
let mKey = 0, mSeek = false, mFlag = true;
let aud = new Audio();
aud.src = 'https://music.163.com/song/media/outer/url?id=1376901250.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.background= 'linear-gradient(90deg, black, blue ' + aud.currentTime / aud.duration * 100 + '%, snow 0)';
prog.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for(j=0; j<lrcAr.length; j++) {
if(aud.currentTime >= lrcAr) {
if(mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.style.animationPlayState = 'running');
let showLrc = (time) => {
lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
lrc.innerHTML = lrcAr;
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;
let mtime = lrcAr - (aud.currentTime - lrcAr);
showLrc(mtime);
}
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;
}
</script> 代码
<style>
#papa { left: -214px; width: 1024px; height: 640px; background: #ccc url('https://638183.freep.cn/638183/qd/layudown.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 0; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, red, green); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center;transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid tan; border-radius: 6px; opacity: .25; }
#btnplay { width: 20px; height: 20px; background: #eee; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, black, blue 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: olive; opacity: .75; }
#lrc { position: absolute; top: 15px; font: bold 2em sans-serif; color: transparent; background: linear-gradient(-90deg, tomato, snow) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
#birds {position: absolute;left: 0;top: 0;width: 200px;offset-distance: 0;offset-path: path("M1100 50 H200 L-100 -50");animation: move 12s linear infinite;}
@keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes move { to { offset-distance: 100%;} }
</style>
<div id="papa">
<img id="birds" src="https://638183.freep.cn/638183/qd/rini.png" alt="" />
<div id="lrc">花潮lrc在线</div>
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
</div>
<script>
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
let mKey = 0, mSeek = false, mFlag = true;
let aud = new Audio();
aud.src = 'https://music.163.com/song/media/outer/url?id=1376901250.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.background= 'linear-gradient(90deg, black, blue ' + aud.currentTime / aud.duration * 100 + '%, snow 0)';
prog.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for(j=0; j<lrcAr.length; j++) {
if(aud.currentTime >= lrcAr) {
if(mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.style.animationPlayState = 'running');
let showLrc = (time) => {
lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
lrc.innerHTML = lrcAr;
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;
let mtime = lrcAr - (aud.currentTime - lrcAr);
showLrc(mtime);
}
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;
}
</script>
本帖测试拼音语言的“逐字”同步效果。测试过程中体会到,还是方块字更好伺候。
拼音文字的排版也没有方块字的方便。方块字不占用太多的空间,而且总是可以做到左右、上下规则排版,即使音标点符号问题,左右两端对齐也显得自然;拼音文字没这个便利,两端对齐后中间会很稀疏,美感严重受到破坏。
可见汉字的伟大不是吹的。 鸟群飞行路径:offset-path: path("M1100 50 H200 L-100 -50"); 。非常简单:M1100 50,表示移动到(1100,50)处,这是路径的原点即运动对象的出发点,接着 H200,表示从原点水平移动到 200 处,最后,从 200 这个地方 L-100 -50,意思是以直线移动到(-100,-50)处。
路径理论上不在乎运动对象的初始位置,可以不理睬left、top的具体设计但要设置,作为前提,运动对象的 position 应设置为 absolute。
马黑黑 发表于 2022-9-18 07:23
本帖测试拼音语言的“逐字”同步效果。测试过程中体会到,还是方块字更好伺候。
拼音文字的排版也没有方 ...
还不错啊,字词同步得挺好的,说明这种同步对所有内容都有很好的适应性呢{:4_187:} 马黑黑 发表于 2022-9-18 07:29
鸟群飞行路径:offset-path: path("M1100 50 H200 L-100 -50"); 。非常简单:M1100 50,表示移动到(1100,5 ...
“路径理论上不在乎运动对象的初始位置”
记下了{:4_187:} 飞机的路径设计很漂亮{:4_187:} 先听先看。等会再来研究学习?谢谢老黑! 加林森 发表于 2022-9-18 09:11
先听先看。等会再来研究学习?谢谢老黑!
{:4_190:} 红影 发表于 2022-9-18 09:03
还不错啊,字词同步得挺好的,说明这种同步对所有内容都有很好的适应性呢
从着色效果看和方块字是一样的 红影 发表于 2022-9-18 09:03
“路径理论上不在乎运动对象的初始位置”
记下了
不过习惯上还是接近路径出发点的好{:4_173:} 红影 发表于 2022-9-18 09:04
飞机的路径设计很漂亮
这个超简单的路线 马黑黑 发表于 2022-9-18 07:29
鸟群飞行路径:offset-path: path("M1100 50 H200 L-100 -50"); 。非常简单:M1100 50,表示移动到(1100,5 ...
黑黑这个鸟png感觉用gif会动的效果会漂亮一点吧 小辣椒 发表于 2022-9-18 11:12
黑黑这个鸟png感觉用gif会动的效果会漂亮一点吧
是的,会展翅的更好。我加工这个不像费太多时间,也没那么多时间,那么多只 马黑黑 发表于 2022-9-18 11:40
是的,会展翅的更好。我加工这个不像费太多时间,也没那么多时间,那么多只
你是真的厉害了,每天一个新分享,神速的,今天我没有时间做了,下午得出去 小辣椒 发表于 2022-9-18 11:45
你是真的厉害了,每天一个新分享,神速的,今天我没有时间做了,下午得出去
我也有些忙,忙里偷闲做一些 马黑黑 发表于 2022-9-18 09:19
谢谢。才做完核酸检测。 我就进来看一下,太难了。{:4_173:} 红芍药 发表于 2022-9-18 12:33
我就进来看一下,太难了。
英文是多了点 马黑黑 发表于 2022-9-18 09:20
从着色效果看和方块字是一样的
是的,完全不受字母字还是方块字的影响。
页:
[1]
2