我害怕
<style>#papa { left: -214px; width: 1024px; height: 640px; background: url('/data/attachment/forum/202209/24/075502mq24qjah9hyy7z4q.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; box-shadow: 3px 3px 20px #000; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; left: 10px; bottom: 10px; }
#btnwrap { fill: snow; cursor: pointer; }
#btnwrap:hover { fill: lightgreen; }
#tmsg { fill: snow; stroke: gray; stroke-width: 1px; font: bold 1em sans-serif; }
#lrc { position: absolute; left: 140px; bottom: 50px; font: bold 2.4em sans-serif; color: transparent; background: linear-gradient(-90deg, snow, transparent) 0 0 / 200% 200%; filter: drop-shadow(2px 2px 4px #666); background-clip: text; -webkit-background-clip: text; text-stroke: 1px lightgreen; -webkit-text-stroke: 1px white; }
#heart { position: absolute; background: hsl(0,100%,30%); left: 220px; top: 230px; height: 50px; width: 50px; transform: rotate(-60deg); animation: beat 0.8s infinite; }
#heart::before { position: absolute; content: ''; background: inherit; width: 100%; height: 100%; border-radius: 50%; top: -25px; }
#heart::after { position: absolute; content: ''; background: inherit; width: 100%; height: 100%; border-radius: 50%; left: 25px; }
#face { position: absolute; left: 344px; top: 135px; width: 16px; height: 10px; background: #aaa; border-radius: 50%; }
#face::before { position: absolute; content: ''; width: 100px; height: 40px; left: -40px; top: -50px; background: #1b1b1b; opacity: .8; animation: opa 4s linear infinite alternate;}
@keyframes bgMove1 { to { background-position: -100% 0; } }
@keyframes bgMove2 { to { background-position: -100% 0; } }
@keyframes beat { to { transform: scale(1.05) rotate(-55deg); } }
@keyframes opa { to { opacity: 0; } }
</style>
<div id="papa">
<span id="lrc">花潮lrc在线</span>
<span id="face"></span>
<span id="heart"></span>
<svg id="mplayer" width="120" height="120">
<g id="mama" transform="rotate(-90, 60, 60)" style="cursor: pointer">
<circle id="track" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="rgba(255,255,255,0.65)" />
<circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="6" stroke="rgba(57,54,81,0.85)" />
</g>
<g id="btnwrap">
<path id="btnplay" d="M 50 50,50 70,70, 60 z"></path>
<path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z" style="display:none"></path>
<path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" />
</g>
<path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none"/>
<path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none"/>
<g id="tmsg">
<text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text>
<text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text>
</g>
</svg>
</div>
<script>
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
let mKey = 0, mFlag = true, aud = new Audio();
let cc = {
x: 1*track.getAttribute('cx'),
y: 1*track.getAttribute('cy'),
r: 1*track.getAttribute('r'),
len: track.getTotalLength(),
};
prog.style.strokeDasharray = prog.style.strokeDashoffset =cc.len;
aud.src = 'https://music.163.com/song/media/outer/url?id=474567044.mp3';
aud.autoplay = true;
aud.loop = true;
mama.onclick = (e) => {
let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;
deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;
aud.currentTime = aud.duration * deg / 360;
};
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;
curMsg.textContent = toMin(aud.currentTime);
durMsg.textContent = toMin(aud.duration);
for(j=0; j<lrcAr.length; j++) {
if(aud.currentTime >= lrcAr) {
if(mKey === j) showLrc(lrcAr || 5);
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;
if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
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>
本帖最后由 亚伦影音工作室 于 2022-9-24 08:38 编辑
新作赞一下!歌词加餐后每一句给的毫秒能-1就基本完美了,老师能在插件里设置一下就省去修改了,我只是个人认为的,你觉得合适就改,不合适就不要动了!只是对拖长音这样处理! 哈哈,看到标题还以为黑黑害怕了{:4_189:} 哇,全代码的“心”,还是会动的,嵌在文字当中,很炫{:4_199:} 白色的歌词逐字同步,在这个帖子里竟也那么好看呢,看来对于色彩来说,整体协调了,就是美{:4_199:} 帖子做得这么漂亮,还怕什么怕啊,别怕了哦{:4_170:} 红影 发表于 2022-9-24 09:40
帖子做得这么漂亮,还怕什么怕啊,别怕了哦
是薛之谦害怕,我也在给他壮胆(心)的 亚伦影音工作室 发表于 2022-9-24 08:28
新作赞一下!歌词加餐后每一句给的毫秒能-1就基本完美了,老师能在插件里设置一下就省去修改了,我只是个人 ...
根据歌词演唱的规律,这个减法没有任何意义,但可能对你喜欢的音乐有用——你爱用的音乐有共同点,节奏前后保持一致。但这类歌曲只是歌曲中的一部分,不具备共性。所以加入你的预设算法,本坛不接受。 红影 发表于 2022-9-24 09:39
白色的歌词逐字同步,在这个帖子里竟也那么好看呢,看来对于色彩来说,整体协调了,就是美
色彩的学问大了去的。我这个,背景图片是低质量的,才18.7KB,这在东篱看了,这样的图片怎么可以拿得出手!{:4_170:}
所以要认真设计,仔细配色 本帖最后由 马黑黑 于 2022-9-24 11:15 编辑
红影 发表于 2022-9-24 09:38
哇,全代码的“心”,还是会动的,嵌在文字当中,很炫
图片有缺陷,用心弥补下 红影 发表于 2022-9-24 09:34
哈哈,看到标题还以为黑黑害怕了
俺无所畏惧 马黑黑 发表于 2022-9-24 10:20
图片有缺陷,用个新弥补下
这个补得太巧妙了,看起来就该有那颗心似的。
原图的缺陷反倒被你弄成了亮点,巧妙的构思就是如此点石成金的{:4_199:} 马黑黑 发表于 2022-9-24 10:20
俺无所畏惧
对,这样才豪横{:4_199:}
不过我有点畏惧,队长这半天没上来,我忍不住越权加精了,我的畏惧是怕队长不开心{:4_173:} 马黑黑 发表于 2022-9-24 10:19
色彩的学问大了去的。我这个,背景图片是低质量的,才18.7KB,这在东篱看了,这样的图片怎么可以拿得出手 ...
图片不在像素高低,做得好了,一样光彩四溢{:4_187:} 马黑黑 发表于 2022-9-24 10:13
是薛之谦害怕,我也在给他壮胆(心)的
你可以跟他说一句,哥们,站直了,别趴下{:4_173:} 是怕不够黑吧 绿叶清舟 发表于 2022-9-24 10:59
是怕不够黑吧
估计是 黑黑居然用了我害怕这歌{:4_173:}
哈哈~~也是特别喜欢的一首煽情歌曲 这会跳动的心脏太诱惑了,我必须要用一次{:4_170:} 黑色背景的白色歌词也是慢漂亮的