lbk60ox 发表于 2024-10-10 05:23:13

前端|怎么样制作音乐播放器


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">欢迎点击「算法与编程之美」↑关注<span style="color: black;">咱们</span>!</span></strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">本文首发于<span style="color: black;">微X</span>公众号:"算法与编程之美",欢迎关注,<span style="color: black;">即时</span><span style="color: black;">认识</span><span style="color: black;">更加多</span>此系列<span style="color: black;">文案</span>。</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><a style="color: black;">欢迎加入团队圈子!与作者面对面!直接点击!</a></strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">新建文件目录</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">在</span>Hbuilder<span style="color: black;">在新建一个目录,分别创建</span>html<span style="color: black;">,</span>css<span style="color: black;">和</span>js<span style="color: black;">文件。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/ibvOwOgkd4UouibTXJzNmgNF5cZtXUCQOQ62eRXxAf1SibUQictCIzwGbQXKhJ3xRlHKhUCO95sEfuAvPS4bh08YxA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">图</span>1</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">搭建音乐播放器框架</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">创建一个主容器</span>class="photo"<span style="color: black;">来为音乐播放器搭建背景框架。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&lt;!--框架 --&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;&lt;article&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;div&gt;模特&lt;/div&gt;&nbsp; &lt;!--歌名 --&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;div&gt;李荣浩&lt;/div&gt;&lt;!--<span style="color: black;">歌手</span> --&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;div&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--音乐图标 --&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--<span style="color: black;">歌词</span> --&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&lt;div&gt;&lt;/div&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;/div&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;&lt;/article&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">插进</span>音乐播放器</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">在框架下方<span style="color: black;">插进</span>音乐播放器</span>audio<span style="color: black;">,其中,</span>src<span style="color: black;"><span style="color: black;">暗示</span>音频的<span style="color: black;">位置</span>,音频后面则<span style="color: black;">表示</span>当浏览器不支持</span>audio<span style="color: black;">时<span style="color: black;">表示</span>的内容。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&lt;!--音乐播放器--&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;&lt;audio id="myMusic" src="content/flac/<span style="color: black;">李荣浩</span> -<span style="color: black;">模特</span>.mp3"&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: black;">您的浏览器不支持音乐播放</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;&lt;/audio&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">创建歌词页面</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">用</span>&lt;textarea&gt; <span style="color: black;">标签(多行的文本输入控件)来装载歌词。其中,</span>cols<span style="color: black;">属性<span style="color: black;">暗示</span>列数,</span>rows<span style="color: black;">属性<span style="color: black;">暗示</span>行数;而</span>display: none<span style="color: black;"><span style="color: black;">暗示</span></span>div<span style="color: black;"><span style="color: black;">隐匿</span>,<span style="color: black;">倘若</span>是</span>block<span style="color: black;">,<span style="color: black;">便是</span><span style="color: black;">表示</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&lt;!--歌词--&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&lt;textarea name="" id="txt" cols="30" rows="10" &nbsp;style="display: none;"&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">模特 - <span style="color: black;">李荣浩</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">词:周耀辉</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">曲:李荣浩</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">穿华丽的服装 为原始的<span style="color: black;">巴望</span>而站着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">用完美的表情 为脆弱的城市而撑着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">我冷漠的接受 你焦急的等待<span style="color: black;">亦</span>困着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">像无数<span style="color: black;">存活</span>在橱窗里的模特</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了灯以外 <span style="color: black;">我还能看见什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了光以外 <span style="color: black;">我还能<span style="color: black;">需求</span>什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了你以外 <span style="color: black;">还能倚赖哪一个</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在千里以外 <span style="color: black;">在呼喊的是什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在百年以后<span style="color: black;">想回忆的是什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在离开以前 <span style="color: black;">能否再见那一刻</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">记得 <span style="color: black;">你的眼睛将会亮着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">我的手臂将会挥着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">谁说世界早已<span style="color: black;">无</span><span style="color: black;">选取</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">趁着我会喜怒你会哀乐</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">唱几分钟情歌</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">没什么 <span style="color: black;"><span style="color: black;">最少</span>证明<span style="color: black;">咱们</span>还活着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">像单纯的蝴蝶 为玫瑰的甜美而飞着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">像顽皮的小猫 为明天的好奇而睡着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">是混乱的时代 是透明的监狱<span style="color: black;">亦</span>觉得</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">是<span style="color: black;">不可</span>继续在橱窗里做模特</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了风以外 <span style="color: black;">我还能听到什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了尘以外 <span style="color: black;">我还能拒绝什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">除了你以外 <span style="color: black;">还能倚赖哪一个</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在千里以外 <span style="color: black;">在呼喊的是什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在百年以后 <span style="color: black;">想回忆的是什么</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在离开以前 <span style="color: black;">能否再见那一刻</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">记得 <span style="color: black;">你的眼睛将会亮着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">我的手臂将会挥着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">谁说世界早已<span style="color: black;">无</span><span style="color: black;">选取</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">趁着<span style="color: black;">我会喜怒你会哀乐</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">唱几分钟情歌</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">没什么 <span style="color: black;"><span style="color: black;">最少</span>证明<span style="color: black;">咱们</span>还活着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">记得 <span style="color: black;">你的眼睛将会亮着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">我的手臂将会挥着</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">谁说世界早已<span style="color: black;">无</span><span style="color: black;">选取</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">趁着 <span style="color: black;">我会喜怒你会哀乐</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">唱几分钟情歌</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">没什么<span style="color: black;"><span style="color: black;">最少</span>证明<span style="color: black;">咱们</span>还活着</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;&lt;/textarea&gt;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">用</span>CSS<span style="color: black;">来美化界面</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">*{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;margin: 0;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;padding: 0;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.photo{&nbsp;&nbsp; &nbsp;/*<span style="color: black;">总体框架</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;width: 320px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;height: 600px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">bac<span style="color: black;">公斤</span>round: linear-gradient(180deg,#d6ddee,#f1a0a0)fixed;/*<span style="color: black;">背景颜色:</span>xxdeg(<span style="color: black;"><span style="color: black;">方向</span>值</span>):<span style="color: black;"> 用<span style="color: black;">方向</span>值指定渐变的方向</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;margin: 50px auto;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;color: #2c546d;/*<span style="color: black;">文字颜色</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;border-radius: 5px;/*<span style="color: black;">盒子边框四个角的弧度</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">box-shadow: 0 0 7px #ecd5ee;/*<span style="color: black;">盒子外<span style="color: black;">暗影</span><span style="color: black;">体积</span>和颜色</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;overflow: hidden;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.title{&nbsp;&nbsp; &nbsp;/*<span style="color: black;">歌名</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;margin-top: 5px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;width: 100%;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;height: 70px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;font-size: 32px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;text-align: center;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;line-height: 70px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.singer{&nbsp; &nbsp;/*<span style="color: black;">歌手</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;width: 100%;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;height: 40px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;font-size: 18px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;text-align: center;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;line-height: 40px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.play{&nbsp; &nbsp;/*<span style="color: black;">音乐播放器图标</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;width: 152px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;height: 163px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">bac<span style="color: black;">公斤</span>round-image: url("./content/img/yy1.png");</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;bac<span style="color: black;">公斤</span>round-repeat: no-repeat;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;margin: 10px 85px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.lrc{&nbsp;&nbsp; &nbsp;/*<span style="color: black;">歌词</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;width: 100%;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;height: 220px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;margin: 50px auto;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">text-align: center;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;overflow: hidden;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.lrc p{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;line-height: 20px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;font-size: 15px;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.content{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;position: relative;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">.play.rotate{/*<span style="color: black;">绑定动画</span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-webkit-animation: rot 5s linear infinite;/*webkit:<span style="color: black;">浏览器;</span>animation<span style="color: black;">:将动画绑定到</span>div<span style="color: black;">(</span>play<span style="color: black;">)上</span>&nbsp; */</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;animation: rot 5s linear infinite;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">@keyframes rot{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;from{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;transform: rotate(0deg); /*deg:<span style="color: black;">旋转<span style="color: black;">方向</span></span>*/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">to{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;transform: rotate(360deg);</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">其中,</span>@keyframes<span style="color: black;">创建动画,后面跟动画名<span style="color: black;">叫作</span>,指定的变化时<span style="color: black;">出现</span>时<span style="color: black;">运用</span>%,或关键字</span>"from"<span style="color: black;">和</span>"to"<span style="color: black;">;</span>animation<span style="color: black;">属性<span style="color: black;">掌控</span>动画的外观,<span style="color: black;">运用</span><span style="color: black;">选取</span>器绑定动画。</span>animation<span style="color: black;">属性多种多样,其中,</span>animation-name<span style="color: black;">规定</span>@keyframes<span style="color: black;">动画的名<span style="color: black;">叫作</span>;</span>animation-duration<span style="color: black;">规定动画完成一个周期所花费的秒或毫秒,默认值是</span>0<span style="color: black;">;</span>animation-timing-function<span style="color: black;">规定动画的速度曲线,默认是</span>"ease"<span style="color: black;">;</span>animation-delay<span style="color: black;">规定动画何时<span style="color: black;">起始</span>,默认是</span> 0<span style="color: black;">。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">引入</span>JavaScript<span style="color: black;">,使图标按钮动起来</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var btn = document.getElementsByClassName("play")//<span style="color: black;">取音乐图标</span>(<span style="color: black;">按钮</span>)</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var myMusic = document.getElementById("myMusic")//<span style="color: black;">取音乐播放器</span>(<span style="color: black;">播放器</span>)</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var txt = document.getElementById("txt")//<span style="color: black;">取歌词</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var con = document.getElementsByClassName("content")</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var mark = true</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">btn.onclick = function(){ //<span style="color: black;">按钮点击时执行</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;if(mark){</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">this.className += " rotate"</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;myMusic.play()//<span style="color: black;">播放音乐</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;mark = false</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}else{</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;this.className = "play"</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;myMusic.pause()//<span style="color: black;">暂停音乐</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;mark = true</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var lrc = txt.value</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var lrcArr = lrc.split("[")//<span style="color: black;">从哪里<span style="color: black;">起始</span>获取歌词</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var html = ""</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">//<span style="color: black;">从头<span style="color: black;">起始</span>获取歌词</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">for(var i=0; i &lt; lrcArr.length ; i++){//<span style="color: black;">歌词长度</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;var arr = lrcArr.split("]")</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;var time = arr.split(".")</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var timer = time.split(":")//<span style="color: black;">分隔音乐播放时<span style="color: black;">表示</span>的时刻:分和秒</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp; &nbsp;var ms = timer * 60 + timer * 1 //1<span style="color: black;">分钟的时间</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;var text = arr</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;if(text){//<span style="color: black;">判断</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">html += "&lt;p id=" + ms +"&gt;" + text + "&lt;/p&gt;"</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;con.innerHTML = html</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">//<span style="color: black;">动画</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var num = 0</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var oP = con.getElementsByTagName("p")//<span style="color: black;">获取</span>p<span style="color: black;">标签</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">myMusic.addEventListener("timeupdate",function(){ &nbsp;//<span style="color: black;">取得歌的时间</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">var curTime = parseInt(this.currentTime) //<span style="color: black;">把当前时间取到,并转换为整数</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;if(document.getElementById(curTime)){</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;for(var i=0; i &lt; oP.length ; i++){</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">oP.style.cssText = "font-size: &nbsp;15px;"</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;} //<span style="color: black;">对歌词样式做处理</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">document.getElementById(curTime).style.cssText = "bac<span style="color: black;">公斤</span>round: &nbsp;linear-gradient(-3deg,#eebd89 0%,#d13abd 100%);-webkit-bac<span style="color: black;">公斤</span>round-clip: &nbsp;text;color: transparent;font-size: 20px;"//<span style="color: black;">播放音乐时,字体颜色变换</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if(oP[ 7 + num].id == curTime){</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.style.top = -20 * num + "px"</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; num ++</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp;&nbsp; &nbsp;}</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">})</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">效果图:</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/ibvOwOgkd4UouibTXJzNmgNF5cZtXUCQOQHhDVR88aLpjqrBc7VHCIvTMpVA15s8GjUg2HJ8uOtaE3WSaZ3JgIEA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">图</span>2</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">在我看来,该播放器制作的难点在于</span>animation<span style="color: black;">和</span>@keyframes<span style="color: black;">的联合<span style="color: black;">运用</span>以及</span>js<span style="color: black;">代码的运用。本文参照网络视频完成,如有错误,还请指正。</span></span></p><span style="color: black;">END</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">实习主编&nbsp; &nbsp;| &nbsp; 王楠岚</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">&nbsp;&nbsp; 责 &nbsp; &nbsp; &nbsp; 编&nbsp; &nbsp;| &nbsp;&nbsp;江南沐雪</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">&nbsp;where2go 团队</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">微X</span>号:算法与编程之美&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></p><img src="https://mmbiz.qpic.cn/mmbiz_jpg/ibvOwOgkd4UoEw5rZykXncKXpzeHicpicURwoykaSNiamf6FSOYacP70cXzbaYSJYLiamzfc8uauLgstJSrdVY713Kw/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">长按识别二维码关注<span style="color: black;">咱们</span>!</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">温馨提示:</span></strong>点击页面右下角<span style="color: black;">“写留言”<span style="color: black;">发布</span>评论,期待您的参与!期待您的转发!</span></span></p>




b1gc8v 发表于 2024-10-17 09:27:00

你的言辞如同繁星闪烁,点亮了我心中的夜空。

j8typz 发表于 2024-10-18 20:33:47

软文发布论坛开幕式圆满成功。 http://www.fok120.com

4zhvml8 发表于 2024-10-24 05:16:11

外贸论坛是我们的,责任是我们的,荣誉是我们的,成就是我们的,辉煌是我们的。

4lqedz 发表于 2024-10-25 13:31:56

我完全赞同你的观点,思考很有深度。

qzmjef 发表于 2024-10-30 15:01:11

i免费外链发布平台 http://www.fok120.com/
页: [1]
查看完整版本: 前端|怎么样制作音乐播放器