新年祝福《我们运气越来越好》
本帖最后由 亚伦影音工作室 于 2024-1-31 17:04 编辑 <br /><br /><style>#papa { margin: 0 0 0 calc(50% - 693px); width: 1164px; height: 640px; background: url('https://pic.imgdb.cn/item/64c509b41ddac507ccc4996a.jpg') no-repeat center/cover; box-shadow: 0px 0px 5px #000; position: relative; z-index: 1; display: grid; place-items: center;overflow: hidden; }
#prog { position: absolute; bottom: 20px; width: 280px; height: 5px; background: linear-gradient(to right, #880000, #880000 var(--prg), white 0); color: snow; display: grid; place-items: center; --prg: 0%; --state: paused;border-radius: 2px;}
#prog::before, #prog::after { position: absolute;color: #880000; font:normal 1em 华文新魏;}
#prog::before { content: attr(data-cu); left:-45px; top: -5px; }
#prog::after { right: -45px; content: attr(data-du); ; top: -5px; }
#slider { position: absolute; width: 6px; height: 6px; background: #cccccc;box-shadow: 0px 0px 0px 4px #880000; left: var(--prg); border-radius: 50%; }
#btnplay { position: absolute; top: -70px; width: 50px; height: 50px; background: url('https://pic.imgdb.cn/item/65141b72c458853aef4cff4a.png') no-repeat center/cover; cursor: pointer; animation: rot 6s infinite linear var(--state); }
@keyframes rot { to { transform: rotate(1turn); filter: hue-rotate(360deg);} }
.ipic { position: absolute; bottom: 0;transform: skew(-3deg);transform-origin: 0% 0%;}
.ipic:nth-of-type(1) { left: 20px; top: -28px;animation: skew1 3sinfinite linear;width: 400px; height: 420px;}
.ipic:nth-of-type(2) { left: 650px; top: -20px; animation: skew2 6sinfinite linear; width: 250px; height: 420px; }
.ipic:nth-of-type(3) { left: 860px; top: -10px;animation: skew3 3sinfinite linear;width: 155px; height: 220px;}
.stop .ipic:nth-of-type(1){animation-play-state: paused;}
.stop .ipic:nth-of-type(2){animation-play-state: paused;}
.stop .ipic:nth-of-type(3){animation-play-state: paused;}
@keyframes skew1 { 50%{ transform: skew(3deg); } }
@keyframes skew2 { 50%{ transform: skew(3deg); } }
@keyframes skew3 { 50%{ transform: skew(3deg); } }
#pic { position: absolute; bottom: 0; transform: rotate(0.5deg);transform-origin: bottom center;left: 20px; animation: ske 0.5sinfinite linear ;width: 300px; height: 420px;}
@keyframes ske { 50%{ transform: rotate(-0.5deg); }
}
#vid { position: absolute; width: 100%; height: 100%; top:0%; object-fit: cover; pointer-events: none;opacity: 1;z-index: -1; transition: 0.1s all ease;}
#papa::before { position: absolute; content: ''; width: 60%; height: 45%; background: url('https://pic.imgdb.cn/item/65b9f916871b83018afd453f.png')0 0/100% 100%; transition: 1s all ease;transform: scale(.8)skew(-10deg) }
#papa:hover::before { opacity: 1; transform: scale(.4)skew(30deg); }
#lrc {
--state: paused;
--motion: cover2;
--tt: 2s;
--bg: linear-gradient(0deg, #ff0000, #ff0000, #ff0000);
position: absolute;z-index: 6;
left: 52%;
transform: translate(-50%);
top: 500px;
font:normal 3em 华文新魏;
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: 20%;
height: 100%;
color: transparent;
overflow: hidden;
white-space: pre;
background: var(--bg);
-webkit-background-clip: text;
animation: var(--motion) var(--tt) linear forwards;
animation-play-state: var(--state);
}
@keyframes cover1{0% { width: 0%;}100% { width: 100%;filter: hue-rotate(360deg);}}
@keyframes cover2 { 0% { width: 0%;}100% { width: 100%;filter: hue-rotate(360deg);}}
</style>
<div id="papa">
<video id="vid"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/b5bdec9d74ebcd425893bc86abedd3ce_preview.mp4" muted autoplay loop></video>
<div id="testImg">
<img class="ipic" src="https://pic.imgdb.cn/item/65b9f53b871b83018af0d46a.png" alt="" />
<img class="ipic" src="https://pic.imgdb.cn/item/65b9f4fe871b83018af0118c.png" alt="" />
<img class="ipic" src="https://pic.imgdb.cn/item/65b9f5a6871b83018af2132d.png" alt="" />
</div>
<img id="pic" src="https://pic.imgdb.cn/item/65ba07e6871b83018a2e5689.png" alt="" />
<div id="prog" data-cu="00:00" data-du="00:00" title="调节进度">
<span id="btnplay" title="播放/暂停"></span>
<span id="slider"></span>
</div>
<div data-lrc="亚伦影音工作室" id="lrc" title="歌词显示">亚伦影音工作室</div>
</div>
<audio autoplay="" id="aud" loop="" src="https://www.qqmc.com/mp3/music331365520.mp3"> </audio>
<script>
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 = () => prog.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', mState, false);
aud.addEventListener('play', mState, false);
aud.addEventListener('timeupdate', () => { prog.style.setProperty('--prg', aud.currentTime / aud.duration * 100 + '%'); prog.dataset.cu = toMin(aud.currentTime); prog.dataset.du = toMin(aud.duration); });
btnplay.onclick = (e) => { e.stopPropagation(); aud.paused ?( aud.play(),vid.play() ):( aud.pause(),vid.pause()); }
prog.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / prog.offsetWidth;
vid=document.querySelector('#vid');
(function(){
var image = document.getElementById("testImg");
let mState = () => aud.paused ? (image.classList.add('stop')):(image.classList.remove('stop'));
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();
pic.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>pic.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>pic.style.animationPlayState = 'paused');
</script>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `《愿我们运气越来越好》
作词:钟瑜
作曲:炜杰钟瑜
演 唱 :红蔷薇
歌词编辑 :亦是金
- - - - - -
删除昨天的烦恼
开启今天的美好
下载明天的快乐
锁定永远的幸福
记录今天好心情
洋溢幸福的味道
每天心情都要好
生活多彩多妖娆
愿我们运气越来越好
人生路上阳光普照
日子越过就越旺
好事都会来关照
愿我们运气越来越好
家人身体健健康康
活的舒心又逍遥
每天乐呵呵的笑
- - - - - -
记录今天好心情
洋溢幸福的味道
每天心情都要好
生活多彩多妖娆
愿我们运气越来越好
人生路上阳光普照
日子越过就越旺
好事都会来关照
愿我们运气越来越好
家人身体健健康康
活的舒心又逍遥
每天乐呵呵的笑
愿我们运气越来越好
人生路上阳光普照
日子越过就越旺
好事都会来关照
愿我们运气越来越好
家人身体健健康康
活的舒心又逍遥
每天乐呵呵的笑
-- 谢谢欣赏 --
`;
/*变量 :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'),mplayer.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),mplayer.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>
欣赏漂亮的特效音画{:4_204:} 问好亚伦!欣赏点赞学习了!{:4_180:} 欣赏老师佳作!{:4_187:} 感觉看着最右边的灯笼怎么状态不一样,原来是来自视屏的{:4_173:} 这个制作太棒了,特别喜庆热闹。摇动的元素选得好,当中鼠标触动的文字也好。
欣赏亚伦老师好帖{:4_199:} 这个祝贺新春的,红色亮起来,让大家都沾沾喜气{:4_199:} 欣赏点赞学习了
页:
[1]