我来人间一趟(DJ 默涵版)-魏佳艺[代码复杂]
<style>#papa{margin: 10px -300px ; width: 1164px; height: 640px;background: lightgreen url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/f8c26f36f0e7def3294fae69643ba486.jpg') no-repeat center/cover;box-shadow: 2px 2px 2px #000; position: relative; display: grid; place-items: center; z-index: 10000; overflow:hidden;}
#papa:hover #fullscreen { display:block ;}
#fullscreen { position: absolute; top:5%; left:80%;color:#FF0000; filter:drop-shadow( 1px 1px 1px #000000);font: normal 2em华文隶书; opacity: 1; cursor: pointer; z-index: 11}
#pp { position: absolute; top: 75%;width: 100%; left:5px; z-index: 1;}
#mplayer{top: 85%;
left: 85%;
width: 50px;
height: 50px;z-index: 40;
background-color: red;
position: absolute;
transform: rotate(45deg);
animation: heartbeat .8s infinite alternate;
filter: drop-shadow(0px 0px 10px gray);
}
#mplayer::before,#mplayer::after{
content: "";
width: 50px;
height: 50px;
background-color: red;
position: absolute;
border-radius: 50%;
}
#mplayer::before{
left: -30px;
}
#mplayer::after{
top: -30px;
}
@keyframes heartbeat { to { transform: rotate(45deg) scale(0.9); } }
.photo {width: 100%;
height: 100%;
position: absolute;z-index: -2;
top:0px; left:0px;filter:contrast(120%)brightness(100%);
opacity: 0;-webkit-mask-image: radial-gradient(black 28% ,transparent 75%);
animation: round 90s linear infinite;
}
@keyframes round{
5% {
opacity: 0;
transform:translate(200%,0%)scale(1);}
10% {
opacity: 1;
transform:translate(0%,0%)scale(1);}
12% {
opacity: 1;
transform:translate(0%,0%)scale(1);}
18% {
opacity: 0;
transform:translate(-200%,0%)scale(1);}
}
img:nth-child(1) {
animation-delay: 84s;
}
img:nth-child(2) {
animation-delay: 78s;
}
img:nth-child(3) {
animation-delay: 72s;
}
img:nth-child(4) {
animation-delay: 66s;
}
img:nth-child(5) {
animation-delay: 60s;
}
img:nth-child(6) {
animation-delay: 54s;
}
img:nth-child(7) {
animation-delay: 48s;
}
img:nth-child(8) {
animation-delay: 42s;
}
img:nth-child(9) {
animation-delay: 36s;
}
img:nth-child(10) {
animation-delay: 30s;
}
img:nth-child(11) {
animation-delay: 24s;
}
img:nth-child(12) {
animation-delay: 18s;
}
img:nth-child(13) {
animation-delay: 12s;
}
img:nth-child(14) {
animation-delay: 6s;
}
img:nth-child(15) {
animation-delay: 0s;
}
.stop img:nth-child(1) {
animation-play-state: paused;
}
.stop img:nth-child(2){
animation-play-state: paused;
}
.stopimg:nth-child(3){
animation-play-state: paused;
}
.stop img:nth-child(4){
animation-play-state: paused;
}
.stop img:nth-child(5){
animation-play-state: paused;
}
.stop img:nth-child(6){
animation-play-state: paused;
}
.stop img:nth-child(7) {
animation-play-state: paused;
}
.stop img:nth-child(8) {
animation-play-state: paused;
}
.stop img:nth-child(9) {
animation-play-state: paused;
}
.stop img:nth-child(10) {
animation-play-state: paused;
}
.stop img:nth-child(11) {
animation-play-state: paused;
}
.stop img:nth-child(12) {
animation-play-state: paused;
}
.stop img:nth-child(13) {
animation-play-state: paused;
}
.stop img:nth-child(14) {
animation-play-state: paused;
}
.stop img:nth-child(15) {
animation-play-state: paused;
}
</style>
<style>
#midground{
background:url(https://365.tf/disk/tf/1676799062.png)0 0/ 40% 90%;
animation: STAR-MOVE50s linear infinite;position: absolute;overflow:hidden;width: 100%;filter: blur(0px);
height: 100%;z-index: -1;
}
#foreground{
background:url(https://365.tf/disk/tf/1676799062.png)0 0/ 60% 120%;
animation: STAR-MOVE120s linear infinite;position: absolute;overflow:hidden;width: 100%;filter: blur(8px);
height: 100%;z-index: -1;
}
@keyframes STAR-MOVE {
from {
background-position: 0% -600%
}
to {
background-position: 600% 0%
}
}
</style>
<div id="papa">
<span id="fullscreen">全屏观赏</span>
<div id="testImg" >
<img alt="" class="photo" src="https://365.tf/disk/tf/1676637814.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676611859.jpg" />
<img alt="" class="photo"src="https://365.tf/disk/tf/1676550717.jpg" />
<img alt=""class="photo"src="https://365.tf/disk/tf/1676555245.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676605567.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676571860.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676556713.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676549416.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676449988.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676439398.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676290487.jpg" />
<img alt="" class="photo"src="https://365.tf/disk/tf/1676341203.jpg" />
<img alt=""class="photo"src="https://365.tf/disk/tf/1676364179.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676320722.jpg" />
<img alt="" class="photo" src="https://365.tf/disk/tf/1676280389.jpg" />
<div class='pat'>
<divclass='pa'>➣</div><divclass='pa'>➣</div><divclass='pa'>➣</div><divclass='pa'>➣</div><divclass='pa'>➣</div><divclass='pa'>➣</div><divclass='pa'>➣</div><div class='pa'>➣</div>
</div>
</div>
<audio id="MusicPlayer" src="https://www.qqmc.com/mp3/music225801083.mp3" loop autoplay></audio>
<canvas id="pp" title="亚伦影音" ></canvas>
<ul class="list">
<li class="one">我来人间一趟(DJ 默涵版)
<div style="transform:scale(.5)" >演唱:魏佳艺</br>词:陈红卫 曲:徐信</br>
出品:亚伦影音工作室</div></li>
</ul>
<div id="foreground" ></div>
<div id="midground" ></div>
<div type="button" id="btn"title="暂停/播放">
<divid="mplayer"></div></div>
<div id="lrc" data-lrc="亚伦影音工作室">亚伦影音工作室</div>
</div>
<style>
#lrc {
--state: paused;
--motion: cover2;
--tt: 2s;
--bg: linear-gradient(180deg, #880000, #880000);
position: absolute;z-index: 2;
left: 50%;
transform: translate(-50%);
top: 80%;
font:normal 3em 华文隶书;
color: #000078;
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 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
</style>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `
我来人间一趟(DJ 默涵版)-魏佳艺
词:陈红卫
曲:徐信
和声:姚斯婷
混音:苏洲
制作人:亚伦
出品:亚伦影音工作室
我来人间一趟历尽风雨沧桑
无意打碎夕阳却被劝返天堂
我来人间一趟也曾年少轻狂
怎奈世事无常终难如愿以偿
我来人间一趟受尽世态炎凉
回顾前尘过往徒留满腹惆怅
一路上跌跌撞撞受过不少伤
再回首半生已过犹如梦一场
我望着天空愈发地迷茫
不知道未来究竟在何方
一辈子匆匆忙忙虚度着时光
所谓的诗与远方还只是奢望
我随着人潮四处在漂荡
心中的话却不知和谁讲
我来人间一趟本想光芒万丈
谁知世人模样只为碎银几两
我来人间一趟历尽风雨沧桑
无意打碎夕阳却被劝返天堂
我来人间一趟也曾年少轻狂
怎奈世事无常终难如愿以偿
我来人间一趟受尽世态炎凉
回顾前尘过往徒留满腹惆怅
一辈子匆匆忙忙虚度着时光
所谓的诗与远方还只是奢望
我随着人潮四处在漂荡
心中的话却不知和谁讲
我来人间一趟本想光芒万丈
谁知世人模样只为碎银几两
我来人间一趟历尽风雨沧桑
无意打碎夕阳却被劝返天堂
我来人间一趟也曾年少轻狂
怎奈世事无常终难如愿以偿
我来人间一趟受尽世态炎凉
回顾前尘过往徒留满腹惆怅
我来人间一趟本想光芒万丈
谁知世人模样只为碎银几两
我来人间一趟历尽风雨沧桑
无意打碎夕阳却被劝返天堂
我来人间一趟也曾年少轻狂
怎奈世事无常终难如愿以偿
我来人间一趟受尽世态炎凉
回顾前尘过往徒留满腹惆怅
`;
/*变量 :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 (MusicPlayer.currentTime <= lrcAr) {
mKey = j - 1;
break;
}
}
if (mKey < 0) mKey = 0;
if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
let time = lrcAr - (MusicPlayer.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 = () => MusicPlayer.paused ? (lrc.style.setProperty('--state','paused'),mplayer.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),mplayer.style.animationPlayState = 'running');
/*监听播放进度*/
MusicPlayer.addEventListener('timeupdate', () => {
for (j = 0; j < lrcAr.length; j++) {
if (MusicPlayer.currentTime >= lrcAr) {
cKey = j;
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
var image = document.getElementById("testImg"),
button = document.getElementById("btn");
if (image.classList && image && button) {
button.onclick = function() {
if (this.value == '.') {
image.classList.remove('stop');
this.value = '*';
} else {
image.classList.add('stop');
this.value = '.';
}
};
}
MusicPlayer.addEventListener('pause', () => mState());/*监听暂停事件*/
MusicPlayer.addEventListener('play', () => mState());/*监听播放事件*/
MusicPlayer.addEventListener('seeked', () => calcKey());/*监听查询事件*/
mplayer.addEventListener('click', () => { MusicPlayer.paused ? MusicPlayer.play() : MusicPlayer.pause(); });
MusicPlayer.addEventListener('playing', () =>mplayer.style.animationPlayState = 'running');
MusicPlayer.addEventListener('pause', () =>mplayer.style.animationPlayState = 'paused');
midground.style.animationPlayState = MusicPlayer.paused ? 'paused' : 'running';
MusicPlayer.addEventListener('playing', () =>midground.style.animationPlayState = 'running');
MusicPlayer.addEventListener('pause', () =>midground.style.animationPlayState = 'paused');
foreground.style.animationPlayState = MusicPlayer.paused ? 'paused' : 'running';
MusicPlayer.addEventListener('playing', () =>foreground.style.animationPlayState = 'running');
MusicPlayer.addEventListener('pause', () =>foreground.style.animationPlayState = 'paused');
let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
})();
(function() { ypData = ;
let total = 120,idx = 0;
let ctx =pp.getContext('2d');
let w =pp.width =1164, h = pp.height = 120;
let slice = w / total, vmax = Math.max.apply(null, ypData);
MusicPlayer.loop = false;
ctx.strokeStyle = '#00ff00';
ctx.fillStyle = 'hsla(0, 70%, 95%, .75)';
ctx.font = '14px sans-serif';
ctx.shadowOffsetX = ctx.shadowOffsetY = 1;
ctx.shadowBlur = 1;
ctx.shadowColor = '#000';
ctx.fillText('play', 100, 50);
MusicPlayer.addEventListener('ended', () => { idx = 0; MusicPlayer.play(); });
MusicPlayer.addEventListener('timeupdate', () => {
draw();
idx ++;
if(idx > ypData.length - 1) idx = 0;
});
let draw = () => {
let ar = Array(total).fill('0').map( (v,k) => Math.random() * (ypData * h / vmax));
ctx.clearRect(0,0,w,h);
ctx.beginPath();
Array.from({length: total}).forEach((v,k) => ctx.lineTo(slice*k, h - ar));
ctx.stroke();
ctx.fillText(toMin(MusicPlayer.currentTime) + ' / ' + toMin(MusicPlayer.duration), 10, 30);
}
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 fs = true;
fullscreen.onclick = () => {
fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏观赏', document.exitFullscreen());
fs = !fs;
};
</script>
<style type="text/css">
.list{list-style: none; margin-left: 0px;width:100%; height:300px;position:absolute;z-index: 2;overflow:hidden; }
.list li{width: 100%;height: 600px; position:relative; animation: myfirst 60s1 ;line-height: 600px;text-align: center; font: normal 3.5em 黑体;color: rgb(255, 255, 255,0);transition: all .5s;filter:drop-shadow(#ffffff 1px 0 0)drop-shadow(#ffffff 0 1px 0)drop-shadow(#ffffff -1px 0 0) drop-shadow(#ffffff 0 -1px0);}
@keyframes myfirst
{0% { opacity: 0;color:#000000;transform:scale(0)}
10%{ opacity: 1;color: #800000;transform:scale(1)}
15%{ opacity: 1;color: #800000;transform:scale(1)}
50%{ opacity: 0; color: rgb(255, 255, 255,0);transform:scale(1) }
}
</style>
<style>
.pat {position: absolute; top:70%; left:35%;z-index: 6;
--tf: linear;
--effect: hover 2s var(--tf) infinite;
width: 1000px;
}
.stop .pat{
animation-play-state: paused;
}
.pa { display: inline-block;
text-transform: uppercase;
text-align: center;
font-size: 3em;
color: #00ff00;
}
.pa:nth-child(1) {
animation: var(--effect);
}
.pa:nth-child(2) {
animation: var(--effect) .125s;
}
.pa:nth-child(3) {
animation: var(--effect) .25s;
}
.pa:nth-child(4) {
animation: var(--effect) .375s;
}
.pa:nth-child(5) {
animation: var(--effect) .5s;
}
.pa:nth-child(6) {
animation: var(--effect) .675s;
}
.pa:nth-child(7) {
animation: var(--effect) .75s;
}
.pa:nth-child(8) {
animation: var(--effect) 1s;
}
.stop .pa:nth-child(1) {
animation-play-state: paused;
}
.stop .pa:nth-child(2) {
animation-play-state: paused;
}
.stop .pa:nth-child(3) {
animation-play-state: paused;
}
.stop .pa:nth-child(4) {
animation-play-state: paused;
}
.stop .pa:nth-child(5) {
animation-play-state: paused;
}
.stop .pa:nth-child(6) {
animation-play-state: paused;
}
.stop .pa:nth-child(7) {
animation-play-state: paused;
}
.stop .pa:nth-child(8) {
animation-play-state: paused;
}
@keyframes hover {
0% {
transform: scale(0);
color: #000080;
}
20% {
transform: scale(1);
color: #ff0000;
}
50% {opacity: 1;
transform: scale(1);
color: #fff000;
}
80% {
transform: scale(0);
color: #000080;
}
}
</style>
沙发我的 亚伦这个红星做了按钮{:4_199:} 非常棒,亚伦好制作{:4_199:} 好美的花瓣人间。赞。 真的美。 点播放按钮能放所有动态全部停止。这个制作真漂亮,包括图片的选用也很美。欣赏亚伦老师好帖{:4_187:} 红影 发表于 2023-3-15 13:45
点播放按钮能放所有动态全部停止。这个制作真漂亮,包括图片的选用也很美。欣赏亚伦老师好帖
谢谢支持鼓励{:4_358:} 亚伦影音工作室 发表于 2023-3-15 13:51
谢谢支持鼓励
问好亚伦 老师,这个制作真棒{:4_187:} 欣赏佳作!{:4_204:}
页:
[1]