被情伤过的女人 - 孙露
本帖最后由 亚伦影音工作室 于 2024-11-27 22:46 编辑 <br /><br /><style type="text/css">.mnBox {
top: 10px;
position: relative;
background: #333 url('https://pic.imgdb.cn/item/67453880d0e0a243d4d0d017.webp') no-repeat center/cover;
height: 720px;
width: 1286px;
left: -340px;overflow: hidden;
border: 1px solid;
box-shadow: 0px 0px 0px 2px tan;
}
.rain {
width: 1px;
height: 8px;
top: -20px;
left: 400px;
background: #eee;
position: relative;
display: block;
animation: rain 0.5s linear infinite;
}
.rain::before, .rain::after{
content: "";
position: absolute;
left: 10px;
top: -120px;
width: 1px;
height: 15px;
background: #eee;
}
.circle {
position:absolute;
width: 3px;
height: 1px;
left: 85px;
top: 90%;
background:none;
border: 1px solid #FFF;
border-radius: 50%;
animation:circle 2s ease-out infinite;
}
@keyframes circle {
0% { width:0; height:0; }
50% { opacity:0.1; width:2%; height:2%; }
60% { opacity:0.2; width:2%; height:2%; }
100% { opacity:0; width:2%; height:2%; }
}
@keyframes rain {
0% { opacity:0.5; }
100% { opacity:0.5; top:40%;}
}
#player {
position: absolute;z-index: 40;
left:35px;
bottom: 50px;
width: 150px;
height: 150px;
opacity: 1;
transition: .4s;
display: grid;
place-items: center;
--sp1: 0; --sp2: 1;
}
#player::before, #player::after {
position: absolute;
content: '';
cursor: pointer;
transition: .4s;
}
#player::before {width: 150px;height: 150px;background:url(https://pic.imgdb.cn/item/65f0d8669f345e8d03ff5c34.png)no-repeat center/cover;
opacity: var(--sp1);}
#player::after {width: 150px;height: 150px;background:url(https://pic.imgdb.cn/item/65f0d8299f345e8d03ff0b31.gif)no-repeat center/cover;
opacity: var(--sp2);}
#phone{position: absolute;z-index: 5;width:60px;content: attr(data-lrc);margin-left:87%;margin-top:90px;display:inline-block;text-align: center;font:400 3.5em/1em 华文隶书; color:rgba(255,255,255,0.7);background:-webkit-linear-gradient(-180deg,rgba(255,255,255,0) 100px,rgba(255,255,255,1) 80px,rgba(255,255,255,1) 640px,rgba(255,255,255,0) 800px) 40px 0px no-repeat;-webkit-background-clip:text;filter:drop-shadow(#000 1px 0 0)drop-shadow(#000 0 1px 0)drop-shadow(#000 -1px 0 0) drop-shadow(#000 0 -1px0);}
#lrc {--state: paused;--motion: cover2;--tt: 2s;--bg: linear-gradient(0deg, #880000, #880000, #880000);
position: absolute;z-index: 6;left: 50%; top: 80%;transform: translate(-50%);font:normal 3.5em 华文隶书; font-weight:400;color: #000080;white-space: pre;-webkit-background-clip: text;filter:drop-shadow(#FFFFFF 1px 0 0)drop-shadow(#FFFFFF 0 1px 0)drop-shadow(#FFFFFF -1px 0 0) drop-shadow(#FFFFFF 0 -1px0);}
#lrc::before {position: absolute;content: attr(data-lrc);width: 100%; height: 100%;color: transparent;overflow: hidden;white-space: pre;background: var(--bg);clip-path: inset(0 100% 0 0);-webkit-background-clip: text;animation: var(--motion) var(--tt) linear forwards;animation-play-state: var(--state);}
@keyframes cover1{ to { clip-path: inset(0 0 0 0); } }@keyframes cover2 { to { clip-path: inset(0 0 0 0); } }
</style>
<divclass="mnBox"id="mnBox">
<div id="player" title="/" ></div>
<div data-lrc="" id="lrc"></div>
<div id="phone">被情伤过的女人<p style="font:400 0.8em/1.2em 华文隶书; width:25px;margin-left:12px;text-align: center;">*孙露*</p></div>
<span class="rain"></span>
<span class="circle"></span>
</div>
<audio id="aud" src="https://s2.ananas.chaoxing.com/sv-w8/audio/d2/e8/d6/7e7f7f93e193625ce886431276736290/audio.mp3" autoplay loop>
<script >
function rain() {
var str = "";
for(i=0; i<50; i++) {
var l = Math.ceil(Math.random()*1286);
str += "<span class='rain' style='left:" + l +"px;'></span>";
}
for(j=0;j<40; j++){
var k1 = Math.ceil(Math.random()*100);
var k2 = Math.round(Math.random()*40+70);
str += "<span class='circle' style='left:" + k1 +"%;top:" + k2 +"%;'></span>";
}
document.getElementById('mnBox').innerHTML += str;
}
rain();
let raindrops = mnBox.querySelectorAll('.rain');
let rainpops = mnBox.querySelectorAll('.circle');
let rainState = () => {
aud.paused ? (raindrops.forEach( drop => {drop.style.animationPlayState='paused'}) , rainpops.forEach( pop => {pop.style.animationPlayState='paused'}))
: (raindrops.forEach( drop => {drop.style.animationPlayState='running'}) , rainpops.forEach( pop => {pop.style.animationPlayState='running'}));
}
let mState = () => {rainState();aud.paused ? (player.style.setProperty('--sp1','1'), player.style.setProperty('--sp2','0')) : (player.style.setProperty('--sp1','0'), player.style.setProperty('--sp2','1'))};
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
player.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
</script>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `被情伤过的女人 - 孙露
作词:吕万山
作曲:赵立兴
专辑:被情伤过的女人
演唱:孙露
☆★Lrc编辑 亚伦★☆
☆★协编 亚伦★☆
● ● ● ● ● ● ●
午夜里孤独的女人
用烟薰着曾经的伤痕
忘不掉那个负心的人
莫非你从来就没悔恨
你身上冷冷的纹身
是为谁雕刻了那么深
你那双忧郁的眼神
再也回不去那么诚恳
被情伤过的女人
再不会轻易打开爱的门
过去那些不属于
自己的缘分
在你眼角 添了皱纹
哦 被情伤过的女人
已经看破了世间的红尘
曾经走过那些
不完美的人生
已风干 你的泪痕
(Music)
☆★亚伦影音工作室谢谢欣赏★☆
=亚伦影音=
`;
/*变量 :mKey - 当前歌词索引;mFlag :调用关键帧动画索引;averAdd :平均值补偿*/
let mKey = 0, mFlag = true, averAdd = 0.3;
/*函数 :获取每句歌词用时,歌词用时若超过平均值则取平均值,最后一句歌词则取平均值*/
let lrcTime = (ar) => {
let tmpAr = [];
for(j = 0; j <ar.length - 1; j ++) {
if(j !== ar.length - 1) tmpAr = parseFloat((ar - ar).toFixed(1));
}
let aver = parseInt(tmpAr.reduce((a,b) => a + b) / (tmpAr.length - 1)) + averAdd;
tmpAr.push(aver);
tmpAr.forEach((item,key) => {
ar = item > aver ? aver : item;
});
return ar;
};
/*函数 :从原始lrc歌词获取信息并存入 n*3 数组*/
let getLrcAr = (text) => {
let lrcAr = [];
let calcRule = ;
for(x of text.split('\n')) {
let ar = [];
let re = /\d+[\.:]\d+([\.:]\d+)?/g;
let geci = x.replace(re,'');
if(geci) {
geci = geci.replace(/[\[\]\'\"\t,]s?/g,'');
let time = x.match(re);
if(time != null) {
for(y of time) {
let tmp = y.match(/\d+/g);
let sec = 0;
for(z in tmp) sec += tmp * calcRule;
ar = ;
lrcAr.push(ar);
}
}
}
}
lrcAr.sort((a,b)=> a - b);
return(lrcTime(lrcAr));
};
/*函数 :模拟显示同步歌词*/
let showLrc = (time) => {
let name = mFlag ? 'cover1' : 'cover2';
lrc.innerHTML = lrcAr;
lrc.dataset.lrc = lrcAr;
lrc.style.setProperty('--motion', name);
lrc.style.setProperty('--tt', time + 's');
lrc.style.setProperty('--state', 'running');
mKey += 1;
mFlag = !mFlag;
};
/*函数 :处理当前歌词索引 mKey*/
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);
};
/*格式化时间信息*/
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 = () => aud.paused ? (lrc.style.setProperty('--state','paused'),player.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),player.style.animationPlayState = 'running');
/*监听播放进度*/
aud.addEventListener('timeupdate', () => {
for (j = 0; j < lrcAr.length; j++) {
if (aud.currentTime >= lrcAr) {
cKey = j;
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
aud.addEventListener('pause', () => mState());/*监听暂停事件*/
aud.addEventListener('play', () => mState());/*监听播放事件*/
aud.addEventListener('seeked', () => calcKey());/*监听查询事件*/
let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
})();
</script>
<script>
var ph=document.getElementById("phone");
var otime=null;
var num=-100;
function tomove(){if(!aud.paused){
otime=setInterval(function (){
num+=10;
if(num==1100)
{
num=-100;
clearInterval(otime);
}
ph.style.backgroundPosition=num+"px 0px";
},20)}
}
tomove();
setInterval(function(){
tomove();
},2000);
</script> https://img.soogif.com/olrt53z1tMMdY6VqE2K7nSCkMRVWeFe0.gif 图做得太美了。 亚伦这个播放器按钮设置,和下雨,歌曲同步,关联制作的很完美{:4_178:} 播放器打开和停止这个效果图图这样运用赞的~ 欣赏亚伦精彩的制作{:4_187:} 欣赏老师的代码音画,点赞!
页:
[1]