亚伦影音工作室 发表于 2024-1-3 19:08

走心入梦的人(DJ 默涵版)

本帖最后由 亚伦影音工作室 于 2024-1-3 19:10 编辑 <br /><br /><style>
#papa {margin: 150px -300px;
        width: 1164px;
        height: 640px;
background:url(https://pic.imgdb.cn/item/65672010c458853aef9d148a.gif)no-repeat center/cover;
        box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 8px #880000;
        position: relative;overflow: hidden;
        z-index: 12345;
}

#vid { position: absolute; width: 60%; height: 60%; top:2%; left:20%;object-fit: cover; pointer-events: none;opacity: 1;z-index: 1; transition: 0.1s all ease;}
#dt{position: absolute;top:0%; left:0%;width: 100%;height: 100%;z-index:-1;}
#papa:hover #mplayer { transition: .7s; opacity: .9; }
#mplayer {z-index: 80;
        position: absolute;
        top:78%; left:66%;
        bottom: 5px;
        width: 30px;
        height: 30px;background:#111111;
        border: 0px solid #cccccc;
        border-radius: 50%;
        opacity: 1;
        transition: .7s;
        display: grid;
        place-items: center;
        --disp1: 0; --disp2: 1;
}
#mplayer::before, #mplayer::after {
        position: absolute;
        content: '';
        border-style: solid;
        border-color: #cccccc;
        cursor: pointer;
        transition: .4s;
}
#mplayer::before {
        width: 0;
        height: 0;
        left: 12px;
        border-width: 10px 12px;
        border-color: transparent transparent transparent #cccccc;
        opacity: var(--disp1);
}
#mplayer::after {
        width: 2px;
        height: 20px;
        border-width: 0 4px 0 4px;
        opacity: var(--disp2);
}
@keyframes opa { to {opacity: 1;} }
#tmsg {position: absolute;z-index: 91;
      font: normal 15px sans-serif;
      color: #ffffff;
         top:91%;
      left:60%;}

#prog {position: absolute;z-index: 91;
      width: 18%;
      height: 2%;
      cursor: pointer;
         top:91.2%;

box-shadow: 0px 0px 0.1px 0.1px #000000;
         left:36%;
border-radius: 3px;}

#wzsd1 { animation: wzsd 0.56s linear infinite ;}
@keyframes wzsd {
from {opacity: 1;filter:hue-rotate(360deg)contrast(180%)brightness(200%);}
50% {opacity: 1;}
to {opacity: 1;filter:hue-rotate(0deg)contrast(140%)brightness(100%);}}

#musickrc{width:50%;line-height:25px;position: absolute;position: absolute;left:25%;top:50%;z-index: 11;filter:drop-shadow(#ffffff 1px 0 0)drop-shadow(#ffffff 0 1px 0)drop-shadow(#ffffff -1px 0 0) drop-shadow(#ffffff 0 -1px0);}
#musickrc span {display:block;text-align:center; }
</style>

<div id="papa">

<div id="dt"><img id="Img" src="https://pic.imgdb.cn/item/65672010c458853aef9d148a.gif" width="100%" height="100%"></div>
<video id="vid"src="http://chuangshicdn.data.mvbox.cn/music/sp/20/12/17/20121709155681262577.mp4" muted autoplay loop></video>
<div id="tmsg">00:00 | 00:00</div>
<divid="prog"></div>
<div id="mplayer"></div>
<divid="musickrc" >
<p id="musickrc01"style="color:#880000; text-align:left;font-weight: ;font-family:华文隶书;font-size: 30px;" ></P>
<P id="musickrc02"style="color:#000080;text-align:right;font-weight: ;font-family:华文隶书;font-size: 30px;"></P>
</div>
<div id="testImg"><div id="bt"><div id="klok">走心入梦的人(DJ 默涵版)</div></di></di>
</div>
<audio id="aud" src="https://www.qqmc.com/mp3/music285455251.mp3" loop autoplay></audio>

<script >
var songkrc =`走心入梦的人(DJ 默涵版)
作词:金艾娜
作曲:钰柃
演唱:金艾娜
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
我相信爱能感天动地
缘分注定我们的今生
`;

function parseLyric(text) { var lines = text.split(/\r|\n|\r\n/),pattern = /\[\d{1,2}:\d{2}.\d{1,3}\]|\[\d{1,2}:\d{2}\]/g,result = []; while (!pattern.test(lines)) {lines = lines.slice(1); }; lines.length === 0 && lines.pop(); lines.forEach(function(v,i,a) { var time = v.match(pattern), value = v.replace(pattern,''); time.forEach(function(v1,i1,a1){ var t = v1.slice(1, -1).split(/:/); result.push(,10) * 60 + parseFloat(t), value]); }); }); result.sort(function(a, b){ return a - b;}); return result;}
var my_audio =document.getElementById("aud");var lyric = parseLyric(songkrc); my_audio.ontimeupdate = function () { for (var i = 0; i < lyric.length; i++) { if(this.currentTime > lyric){ document.getElementById("musickrc01").innerHTML = lyric; if(i+1==lyric.length){ document.getElementById("musickrc01").innerHTML = ""; }else{ document.getElementById("musickrc02").innerHTML = lyric;};};};}; my_audio.play();
/*暂停 播放按钮*/
(function(){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.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();
/*结束*/

/*进度条 进度时间*/
prog.onclick = (e) => {
                aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
      }
aud.addEventListener('timeupdate', () => {
               aud.addEventListener('timeupdate', () => {prog.style.background= 'linear-gradient(90deg, red, red, red ' + aud.currentTime / aud.duration * 100 + '%, #111111 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;
      };
/*结束*/


/*控制歌词颜色*/
klok.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () => klok.style.animationPlayState = 'running');
aud.addEventListener('pause', () => klok.style.animationPlayState = 'paused');
/*结束*/

/*控制文字颜色*/
dt.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () => dt.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>dt.style.animationPlayState = 'paused');
/*结束*/

</script>

<style>
#bt{ width: 500px; height: 50px;color: #00ff00; position: absolute; left:20%;top:5%;font-size: 24px; font-family:华文隶书;z-index: 21; animation: wz 20s linear infinite ; }
.stop #bt{animation-play-state: paused;}
@keyframes wz {
50% {opacity: 1;filter:hue-rotate(0deg)contrast(100%)brightness(100%); left: 60%;}
}

#klok{width: 560px; height: 100%;
-webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
   background-color:#880000;
   background-image:linear-gradient(50deg, #ff0000 40%, #00ff80 50%, #fff000 10%, #000078 60%);
   background-repeat:no-repeat;
line-height:35px;background-position: 0px 0;
    -webkit-animation:loop 1slinearinfinite ;}
@-webkit-keyframes loop{
   50%{background-position: -300px 0;filter:hue-rotate(0deg)contrast(120%)brightness(150%);}
}
</style>

<script>
/*控制动画*/
(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());
})();
/*结束*/
</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;
            // 透明度还原
            image.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;
            }
      }
    };
}

vid=document.querySelector('#vid');
var image= document.getElementById("Img");
mplayer.onclick =function() { aud.paused ? (image.stop(),vid.pause()):(image.play(),vid.play())};
</script>

红影 发表于 2024-1-3 19:46

这个音箱做得真棒啊,有进度条,有播放按钮,还能一键全控。
欣赏亚伦老师好帖{:4_199:}

小辣椒 发表于 2024-1-3 21:03

漂亮,一键控制{:4_199:}

小辣椒 发表于 2024-1-3 21:04

欣赏亚伦精彩的制作

亦是金 发表于 2024-1-4 10:57

欣赏亚伦老师好帖!谢谢分享!{:4_190:}

老谟深虑 发表于 2024-1-4 18:10

         欣赏老师的佳作,点赞!
页: [1]
查看完整版本: 走心入梦的人(DJ 默涵版)