找回密码
 立即注册
搜索
查看: 10|回复: 1

探索 生命线的思考(播放器)

[复制链接]

1512

主题

3206

回帖

1万

积分

管理员

积分
12935
发表于 昨天 14:48 | 显示全部楼层 |阅读模式
播放/暂停(Alt+X)

1512

主题

3206

回帖

1万

积分

管理员

积分
12935
 楼主| 发表于 昨天 15:15 | 显示全部楼层
马老师的代码


<style>
    @import 'https://638183.freep.cn/638183/web/api/audioplayer.css';
    .pa { --offsetX: 81px; --bg: url('https://638183.freep.cn/638183/t24/w8/space.webp') no-repeat center/cover; color: orange; }
    .player { width: 480px; bottom: 10px; }
    .btnFs { top: 25px; right: 20px; }
    #msvg { position: absolute; bottom: 50px; width: 16vw; height: 8vw; cursor: pointer; opacity: 1; }
    #p1 { fill: none; stroke: currentColor; stroke-width: 8; stroke-dasharray: 8; stroke-dashoffset: 100%; animation: move linear 20s infinite; }
    @keyframes move { to { stroke-dashoffset: 0%; } }
</style>

<div id="pa" class="pa">
    <video class="pd-vid" src="https://img2.tukuppt.com/video_show/2269348/00/14/17/5e1c837dca409.mp4" autoplay loop muted></video>
    <svg id="msvg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 200">
        <title>播放/暂停(Alt+X)</title>
        <path id="p1" d="M0 100 H400" />
    </svg>
</div>

<script>
    var options = {
        pa: '.pa',
        urls: [['https://music.163.com/song/media/outer/url?id=38019092', '生命线']],
        btns: [msvg],
    };

    loadJs('https://638183.freep.cn/638183/web/api/audioplayer.min.js', tzRun);

    function tzRun() {
        var aud = new AudPlayer(options);

        aud.aud.ontimeupdate = () => {
            var tt = 15;
            var str = '';
            Array.from({length: tt}).forEach((_,k) => {
                var x = (k + 1) * (360 / tt);
                var y = k % 2 === 0 ? 100 : Math.floor(Math.random() * 200);
                str += k === 0 ? `M0 100 H${x}` : ` L${x} ${y}`;
            });
            path = `${str}L400 100`;
            p1.setAttribute('d', path);
        };
    }

    function loadJs(url, callback) {
        var script = document.createElement('script');
        script.charset = 'utf-8';
        script.src = url;
        script.onload = function() {
            if (callback) callback();
        };
        document.head.appendChild(script);
    }
</script>

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

协同嘉业科技有限公司 ( 京ICP备2024053108号-1 )

GMT+8, 2026-8-14 01:41 , Processed in 0.102607 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表