|
楼主 |
发表于 2025-2-15 12:22:17
|
显示全部楼层
IP:亚太地区
- <br /><br /><style type="text/css">
- #papa { margin: 140px 0 20px calc(50% - 621px); background:url('') no-repeat center/cover;width: 1200px; height: 700px; box-shadow: 3px 3px 6px gray; overflow: hidden; z-index: 1; position: relative; display: grid; place-items: center; }
- #bjbs{animation: rotating 1s linear infinite;width: 1200px; height: 700px;position: absolute;background:url('https://cccimg.com/view.php/2d3863701fe582cb565664e92423ae92.jpg')no-repeat center/cover;}
- @keyframes rotating{50%{filter:hue-rotate(360deg)contrast(110%)brightness(100%);}}
- #mplayer {z-index: 8;
- position: absolute;
- left:90px;
- bottom: 20px;
- width: 40px;
- height: 40px;
- opacity: 1;
- transition: .2s;
-
- place-items: center;
- --disp1: 0; --disp2: 1;
- }
- #mplayer::before , #mplayer::after{
- position: absolute;
- content: '';
- cursor: pointer;
- transition: .2s;
- }
- #mplayer::before {
- width: 40px;
- height: 40px;opacity: 1;
- background: url("https://pic.imgdb.cn/item/666469465e6d1bfa05bd07ea.png") no-repeat center/cover;
- opacity: var(--disp1);
- }
- #mplayer::after {
- width: 40px;
- height: 40px;opacity: 1;
- background: url("https://pic.imgdb.cn/item/6664693a5e6d1bfa05bcf7d3.png")no-repeat center/cover;
- opacity: var(--disp2);
- }
- #tmsg {position: absolute;z-index: 8;
- font: normal 12px sans-serif;
- color: #ffffff;
- bottom: 30px;
- left:87%;}
- #prog {position: absolute;z-index: 8;
- width: 70%;
- height: 1.5px;
- cursor: pointer;
- bottom: 35px;
- left:16%;
- border-radius: 1px;}
- #bt_prev{position: absolute;z-index: 8;
- width:30px;
- height: 30px;
- bottom: 24px;left:40px;
- background: url("https://pic.imgdb.cn/item/6664695c5e6d1bfa05bd23cb.png")no-repeat center/cover;}
- #bt_pnev{position: absolute;z-index: 8;
- width:30px;
- height: 30px;
- bottom: 24px;left:150px;
- background: url("https://pic.imgdb.cn/item/66651ae45e6d1bfa0552bf2a.png")no-repeat center/cover;}
- #lb{ position: absolute; bottom: 30px;right:52px; width: 22px; height: 20px;z-index: 8; }
- #lb img{ width: 100%; height: 100%; }
- .first{
- left:100px;background:url("https://cccimg.com/view.php/c349538ab1e54e665470288cc0cfea2f.jpg")no-repeat center/cover;
- animation: breath 3s infinite linear;
- }
- .second{
- left:300px;background:url("https://cccimg.com/view.php/2a821671bfad68b2a7874d62670638ef.jpg")no-repeat center/cover;
- animation: breath 3s 0.25s infinite linear;
- }
- .third{
- left:500px;background:url("https://cccimg.com/view.php/768e147464e634d6a1305de40e6f9e4b.jpg")no-repeat center/cover;
- animation: breath 3s 0.5s infinite linear;
- }
- .forth{
- left:700px;background:url("https://cccimg.com/view.php/0c398f295f933b023a41b1ee0ab02ccf.jpg")no-repeat center/cover;
- animation: breath 3s 0.75s infinite linear;
- }
- .morex{
- left:900px;background:url("https://cccimg.com/view.php/519a8dcb28b452ad53c1c8a866746d6f.jpg")no-repeat center/cover;
- animation: breath 3s 1s infinite linear;
- }
- .stop .first,
- .stop .second,
- .stop .third,
- .stop .forth,
- .stop .morex{animation-play-state: paused;}
- .ball{
- position:absolute;
- top:0;
- bottom:0; border-radius: 4px;
- margin:auto; box-shadow: 0px 0px 0px 4px #800000 inset,0px 0px 0px 5px #fff inset;
- width:140px;
- height:250px;
- }
- @keyframes breath{
- 0%{
- transform:scale(0.6);
-
- opacity:1;transform-timing-function:linear;
-
- }
- 25%{
- transform:scale(0.8);
-
- opacity:1;
- transform-timing-function:linear;
- }
- 50%{
- transform:scale(1);
-
- opacity:1;
- transform-timing-function:linear;
- }
- 75%{
- transform:scale(1.2);
-
- opacity:1;
- transform-timing-function:ease-out;
- }
- 100%{
- transform:scale(1.4);
-
- opacity:.4;
- transform-timing-function:ease-out;
- }
- }
- .cont {position: absolute;z-index: 2;
- width: 0;
- height: 0;
- top: 20%;
- left: 40%;
- perspective: 420px;
- perspective-origin: center -150px;
- }
- .bird {
- width: 0;
- height: 30px;
- position: absolute;
- top: 50%;
- left: 50%;
- animation: bird 15s infinite linear;
- }
- .bird:nth-child(2) {
- animation-delay: -5s;
- }
- .bird:nth-child(3) {
- animation-delay: -10s;
- }
- .stop .bird::before,
- .stop .bird::after{animation-play-state: paused;}
- .stop .bird,
- .stop .bird:nth-child(2),
- .stop .bird:nth-child(3){animation-play-state: paused;}
- @keyframes bird {
- from {
- transform: translate(-50%, -50%) rotateY(0deg) translate3d(150px, 0, 0);
- }
- to {
- transform: translate(-50%, -50%) rotateY(-360deg) translate3d(150px, 0, 0);
- }
- }
- .bird::before, .bird::after {
- content: "";
- width: 50px;
- height: 30px;
- position: absolute;
- top: 0;
- border: 0 solid;
- border-top: 5px solid #aaa;
- animation: 1s infinite ease-in-out;
- }
- .bird::before {
- right: -3px;
- animation-name: wing-b;
- }
- @keyframes wing-b {
- 0%, 100% {
- border-radius: 10% 100%;
- }
- 33% {
- border-radius: 50% 100%;
- }
- }
- .bird::after {
- left: -3px;
- animation-name: wing-a;
- }
- @keyframes wing-a {
- 0%, 100% {
- border-radius: 100% 10%;
- }
- 33% {
- border-radius: 100% 50%;
- }
- }
- </style>
- <div id="papa">
- <div id="bjbs"> </div>
- <div id="tnpmImg">
- <div class="cont" >
- <div class="bird"></div>
- <div class="bird"></div>
- <div class="bird"></div>
- </div>
- </div>
- <div id="testImg">
- <div class="ball first"></div>
- <div class="ball second"></div>
- <div class="ball third"></div>
- <div class="ball forth"></div>
- <div class="ball morex"></div>
- </div>
- <div id="tmsg">00:00 | 00:00</div>
- <div id="prog" title="播放进度条"></div>
- <div id="bt_prev" title="无效"></div>
- <div id="bt_pnev" title="无效"></div>
- <div id="lb" title="喇叭"><img alt="" id="lbImg" src="https://pic.imgdb.cn/item/662615500ea9cb14035d435e.gif" /></div>
- <div id="mplayer" title="暂停/播放"></div>
- <div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>
- </div>
- <audio autoplay="" id="aud" loop="" src="https://cccimg.com/view.php/5960de26e84caf023b6d9d65324a95b5.mp3"> </audio>
- <style type="text/css">#lrc {
- --state: paused;
- --motion: cover2;
- --tt: 2s;
- --bg: linear-gra**nt(180deg, #880000, #880000);
- position: absolute;z-index: 6;
- left: 40%;
- transform: translate(-50%);
- top: 72%;
- font:normal 3em 华文隶书;
- color: #0000;
- white-space: pre; transform: perspective(120px) rotateY(20deg);
- -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 -1px 0);
- }
- #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 = `[00:00.000]我爱你勐巴拉娜西
- [00:10.350]演唱:亮剑袁雪儿
- [00:20.350]LRC:老谟深虑
- [00:32.700]你是一杯甘甜的美酒
- [00:41.970]醉了蓝天醉了那白云
- [00:49.500]醉了太阳醉了月亮
- [00:57.000]醉了丛林醉了那山冈
- [01:06.390]飘来了辽崖山的彩铃
- [01:10.170]飘来了羁落山的欢乐
- [01:13.920]飘来了布拉山的花香
- [01:17.700]飘来了待牵人的清幽
- [01:22.350]喔我爱你哟勐巴拉娜西
- [01:31.020]我爱你哟勐巴拉娜西
- [01:40.590]风华花开千万朵
- [01:43.890]野桂花下飘万里
- [01:48.150]孔雀飞向在明天
- [01:51.420]就像飞水撒满天
- [02:27.060]你是一朵期盼的蓓蕾
- [02:36.420]醉了神力的风醉了那班子的云
- [02:43.920]醉了江河的水醉了那明朗的月
- [02:51.420]醉了阿布朗的情醉了那萨朵里的爱
- [03:00.810]美丽富饶的地方
- [03:04.560]人间幸福的天堂
- [03:08.190]神奇美丽的家园
- [03:12.030]人人向往的胜地
- [03:16.710]喔我爱你哟勐巴拉娜西
- [03:25.440]我爱你哟勐巴拉娜西
- [03:32.790]你是一颗神奇的绿宝石
- [03:38.250]镶嵌在那绿海里
- [03:42.480]你是一颗璀璨的夜明珠
- [03:45.810]闪烁在那花丛中
- [03:47.790]喔我爱你哟勐巴拉娜西
- [03:59.160]我爱你哟勐巴拉娜西
- [04:08.760]你是一颗神奇的绿宝石
- [04:12.060]匿舵寐避穿五洲
- [04:16.260]你是一颗璀璨的夜明珠
- [04:19.620]名扬四海闯天下
- [04:25.170]喔我爱你喔勐巴拉娜西
- [04:40.080]喔我爱你喔勐巴拉娜西
- `;
- /*变量 :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[j] = parseFloat((ar[j+1][0] - ar[j][0]).toFixed(1));
- }
- let aver = parseInt(tmpAr.reduce((a,b) => a + b) / (tmpAr.length - 1)) + averAdd;
- tmpAr.push(aver);
- tmpAr.forEach((item,key) => {
- ar[key][2] = item > aver ? aver : item;
- });
- return ar;
- };
- /*函数 :从原始lrc歌词获取信息并存入 n*3 数组*/
- let getLrcAr = (text) => {
- let lrcAr = [];
- let calcRule = [60,1,0.001];
- 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[z] * calcRule[z];
- ar[0] = [parseFloat(sec.toFixed(2)), geci];
- lrcAr.push(ar[0]);
- }
- }
- }
- }
- lrcAr.sort((a,b)=> a[0] - b[0]);
- return(lrcTime(lrcAr));
- };
- /*函数 :模拟显示同步歌词*/
- let showLrc = (time) => {
- let name = mFlag ? 'cover1' : 'cover2';
- lrc.innerHTML = lrcAr[mKey][1];
- lrc.dataset.lrc = lrcAr[mKey][1];
- 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[j][0]) {
- mKey = j - 1;
- break;
- }
- }
- if (mKey < 0) mKey = 0;
- if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
- let time = lrcAr[mKey][2] - (aud.currentTime - lrcAr[mKey][0]);
- 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[j][0]) {
- cKey = j;
- if (mKey === j) showLrc(lrcAr[j][2]);
- else continue;
- }
- }
- });
- aud.addEventListener('pause', () => mState());/*监听暂停事件*/
- aud.addEventListener('play', () => mState());/*监听播放事件*/
- aud.addEventListener('seeked', () => calcKey());/*监听查询事件*/
- let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
- })();
- </script>
- <script>
- let mState = () => aud.paused ? (mplayer.style.setProperty('--disp1','1'), mplayer.style.setProperty('--disp2','0')) : (mplayer.style.setProperty('--disp1','0'), mplayer.style.setProperty('--disp2','1'));
- mplayer.onclick =function() { aud.paused ?(aud.play(),imagelb.play()): ( aud.pause(),imagelb.stop())};
- aud.addEventListener('play', () => mState());
- aud.addEventListener('pause', () => mState());
- var imagelb= document.getElementById("lbImg");
- (function(){
- var image = document.getElementById("testImg");var image0 = document.getElementById("tnpmImg");
- let mState = () => aud.paused ? (image.classList.add('stop'),image0.classList.add('stop')):(image.classList.remove('stop'),image0.classList.remove('stop'));
- aud.addEventListener('play', () => mState());
- aud.addEventListener('pause', () => mState());
- })();
- bjbs.style.animationPlayState = aud.paused ? 'paused' : 'running';
- aud.addEventListener('playing', () =>bjbs.style.animationPlayState = 'running');
- aud.addEventListener('pause', () =>bjbs.style.animationPlayState = 'paused');
- /*进度条 进度时间*/
- prog.onclick = (e) => {
- aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
- }
- aud.addEventListener('timeupdate', () => {
- aud.addEventListener('timeupdate', () => {prog.style.background= 'linear-gra**nt(90deg, #ff0000, #ff0000, #ff0000 '+ aud.currentTime / aud.duration * 100 + '%, #eeeeee 0)';});
- tmsg.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
- });
- 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>
- <script>
- /*以下是控制动图的插件*/
- if ('getContext' in document.createElement('canvas')) {
- HTMLImageElement.prototype.play = function() {
- if (this.storeCanvas) {
- // 移除存储的canvas
- this.storeCanvas.parentElement.removeChild(this.storeCanvas);
- this.storeCanvas = null;
- // 透明度还原
- imagelb.style.opacity = '';
- }
- if (this.storeUrl) {
- this.src = this.storeUrl;
- }
- };
- HTMLImageElement.prototype.stop = function() {
- var canvas = document.createElement('canvas');
- // 尺寸
- var width = this.width, height = this.height;
- if (width && height) {
- // 存储之前的地址
- if (!this.storeUrl) {
- this.storeUrl = this.src;
- }
- // canvas大小
- canvas.width = width;
- canvas.height = height;
- // 绘制图片帧(第一帧)
- canvas.getContext('2d').drawImage(this, 0, 0, width, height);
- // 重置当前图片
- try {
- this.src = canvas.toDataURL("image/gif");
- } catch(e) {
- // 跨域
- this.removeAttribute('src');
- // 载入canvas元素
- canvas.style.position = 'absolute';
- // 前面插入图片
- this.parentElement.insertBefore(canvas, this);
- // 隐藏原图
- this.style.opacity = '0';
- // 存储canvas
- this.storeCanvas = canvas;
- }
- }
- };
- }
- </script>
复制代码
|
|