加林森 发表于 2022-2-16 21:46

【出埃及记】(铃声版)(翻自 Maksim Mrvica) - 姜创钢琴


<style>

#bigPa { position: relative; left:- 100px; width: 800px; height: 450px; background:#333 url('https://pic.imgdb.cn/item/620cff3d2ab3f51d918add70.jpg') no-repeat center/cover; box-shadow: 0 0 0 2px #111;}
#gcDiv { width: 500px; float: right; column-count:2; color: #eee; font-size: 1em; text-shadow: 1px 1px 1px #111; }
#paDiv { position: relative; left: 10px; top: 10px; width: 220px; display: flex; align-items: center; border: 1px solid olive; border-radius: 8px 0px 8px 0px; background: rgba(0,0,0,.8); box-shadow: 1px 1px 2px #000; }
#jindu { position: relative; width: 200px; height: 8px; line-height: 8px; font-size: 10px; color: #eee; text-align: center; background: linear-gradient(90deg, olive, green) no-repeat; background-size: 8px 0px; cursor: pointer; }
#btn-ro { width: 20px; height: 20px; line-height: 20px; font-size: 12px; background: linear-gradient(blue, silver, red); outline:none; color: white; border-radius: 50%; text-align: center; cursor: pointer; animation: rol linear 2s infinite; }
#btn-ro:hover { opacity: 0.8; }
#btn-ro:active { opacity: 1; }
@keyframes rol { to { transform:rotate(360deg); } }

</style>

<div id="bigPa">
        <div id="paDiv">
                <div id="btn-ro">·</div>
                <div id="jindu">
                        <div id="jd-go"></div>
                </div>
        </div>
      </div>
</div>

<script language="javascript">

var btn = document.getElementById('btn-ro');
var jindu = document.getElementById('jindu');
var aud = document.createElement('audio');
aud.loop = true;
// 音乐地址放在下行引号内
aud.src = "https://www.joy127.com/url/79367.mp3";
aud.addEventListener('ended', function() { btn.style.animationPlayState="paused"; }, true);
aud.addEventListener('timeupdate', tmMsg, true);
aud.play();

function tmMsg(){ //进度条
        let auT = Math.floor(aud.duration - aud.currentTime);
        let auM = auT / 60;
        let auMs = parseInt(auM);
        if (auMs <10) auMs = "0" + auMs;
        let auS = auT % 60;
        let auSs = Math.round(auS);
        if (auSs < 10) auSs = "0" + auSs;
        jindu.innerHTML = "- " + auMs +":" + auSs;
        let jd = (100*aud.currentTime)/aud.duration;
        jindu.style.backgroundSize = jd+ "% 8px";
}

jindu.onclick = function(){ //进度控制
        let w = offset(jindu,"left");
        let x = (event.clientX - w) * aud.duration / jindu.clientWidth;
        aud.currentTime = x;
}

function offset(obj,direction){//获取父级元素偏移总量
        let offsetDir = "offset" + direction.toUpperCase()+direction.substring(1);
        let realNum = obj;
        let positionParent = obj.offsetParent;
        while(positionParent != null){
                realNum += positionParent;
                positionParent = positionParent.offsetParent;
        }
        return realNum;
}

btn.onclick = function(){ // 暂停&播放
        aud.paused ? (aud.play(), btn.style.animationPlayState="running") : (aud.pause(), btn.style.animationPlayState="paused");
}

</script>

小辣椒 发表于 2022-2-16 22:16

队长这个是127的音乐,现在有的听不到了

小辣椒 发表于 2022-2-16 22:18

队长这个播放器玩了许多次了,后面学习把播放器移动一下再发,同样的就可以修改一下,这样学习就有更多的知识面了

加林森 发表于 2022-2-16 22:20

小辣椒 发表于 2022-2-16 22:16
队长这个是127的音乐,现在有的听不到了

啊?为什么啊?是浏览器的原因吗?

加林森 发表于 2022-2-16 22:20

小辣椒 发表于 2022-2-16 22:18
队长这个播放器玩了许多次了,后面学习把播放器移动一下再发,同样的就可以修改一下,这样学习就有更多的知 ...

受教了。谢谢!

小辣椒 发表于 2022-2-16 22:25

加林森 发表于 2022-2-16 22:20
啊?为什么啊?是浏览器的原因吗?

是现在那边的上传链接会有提示,大多都是以前的上传链接,现在的出来速度会快一点

小辣椒 发表于 2022-2-16 22:26

加林森 发表于 2022-2-16 22:20
受教了。谢谢!

队长谦虚了,现在队长是最优秀的学生的

加林森 发表于 2022-2-16 22:27

小辣椒 发表于 2022-2-16 22:25
是现在那边的上传链接会有提示,大多都是以前的上传链接,现在的出来速度会快一点

我现在没有地方可以去了、80网站出问题了。如果这个地方也不行了,我就找不到地方了。{:5_113:}

加林森 发表于 2022-2-16 22:29

小辣椒 发表于 2022-2-16 22:26
队长谦虚了,现在队长是最优秀的学生的

我只是有感觉就立即制作开始。

小辣椒 发表于 2022-2-16 22:31

加林森 发表于 2022-2-16 22:27
我现在没有地方可以去了、80网站出问题了。如果这个地方也不行了,我就找不到地方了。

你尽量找最近发的歌曲

小辣椒 发表于 2022-2-16 22:32

加林森 发表于 2022-2-16 22:29
我只是有感觉就立即制作开始。

队长你这种套用也是好的,一面要看看黑黑代码什么意思,懂了这个就可以自由发挥了

加林森 发表于 2022-2-16 22:32

小辣椒 发表于 2022-2-16 22:31
你尽量找最近发的歌曲

好的,知道了。

加林森 发表于 2022-2-16 22:37

小辣椒 发表于 2022-2-16 22:32
队长你这种套用也是好的,一面要看看黑黑代码什么意思,懂了这个就可以自由发挥了

就是啊,我在研究的过程中有感受的。
页: [1]
查看完整版本: 【出埃及记】(铃声版)(翻自 Maksim Mrvica) - 姜创钢琴