醉美水芙蓉 发表于 2023-6-3 21:33

你是我的愛 ,我的生命

本帖最后由 醉美水芙蓉 于 2023-6-5 21:02 编辑 <br /><br /><style>
#papa {
        margin: 0 0 0 calc(50% - 593px);
        width: 1024px;
        height: 640px;
        background: lightblue url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/live/185360624d54f427ea1b20fed751c483.mp4.jpg') no-repeat center / cover;
        box-shadow: 3px 3px 20px #000;
        position: relative;
        z-index: 1;
        --state: paused;
}
#mplayer {
      position: relative;
      left: 50px;
      top: 250px;
      animation: rot 6s infinite linear var(--state);
}
@keyframes rot { to { transform: rotate(1turn); } }

</style>

<div id="papa">
        <css-doodle grid="3" id="mplayer">
                :doodle {
                        @size: 160px;
                        background: radial-gradient(darkgreen,transparent 70%,transparent 0);
                        cursor: pointer;
                }
                @shape: clover 3;
                @place: center;
                background: green;
                transform: rotate(calc(@i * 40deg)) translate(60px);
        </css-doodle>
             
<css-doodle id="lrc">                     
:doodle {                              
@size: auto 4em;   
z-index:5;                              
bottom:200px;                               --geci: &quot;css-doodle player&quot;; --motion: cover2; --tt: 1s;                     }                     /* 单元格两个伪元素显示lrc歌词 */   display: grid;                     place-items: center start;                     :before, :after {                               content: var(--geci);                               color: Honeydew; /* 歌词底色 */                               font: bold 2em sans-serif;                               text-shadow: 1px 1px 2px #000;                               white-space: pre;                        }                     :after {                               position: absolute;                               width: 0;                               color:Teal; /* 同步歌词颜色 */                               overflow: hidden;                               animation: var(--motion) var(--tt) linear forwards var(--state);                     }                     @keyframes cover1 { from { width: 0; } to { width: 100%; } }                     @keyframes cover2 { from { width: 0; } to { width: 100%; } }               </css-doodle>    <div class="panda">
        <img src="" alt="" /></div>                <audio id="aud" src="https://www.qqmc.com/mp3/music170783213.mp3" autoplay="" loop=""></audio>    </div>    <script>let slip = 0.5, mFlag = true, mKey = 0, clickIdx = 0, progChg = 0, cursors = ['default','pointer','pointer'];
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
                let calcKey = () => {for (j = 0;j < lrcAr.length;j++) {if (aud.currentTime <= lrcAr) {mKey = j - 1;break;}}if (mKey < 0) mKey = 0;if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
   
   
            let script = document.createElement('script');
            script.src = 'https://638183.freep.cn/638183/web/api/css-doodle.js';
            document.body.appendChild(script);
            let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
let showLrc = (time) => {lrc.style.setProperty('--motion', mFlag ? 'cover1' : 'cover2');lrc.style.setProperty('--geci', '"' + lrcAr + '"');lrc.style.setProperty('--tt', time + 's');mKey += 1;mFlag = !mFlag;};
            aud.addEventListener('play', mState, false);
            aud.addEventListener('pause', mState, false);
                        aud.addEventListener('timeupdate', () => {for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime - slip >= lrcAr) {cKey = j;if (mKey === j) showLrc(lrcAr);else continue;}}mplayer.style.setProperty('--ttmsg1', `'${toMin(aud.currentTime)}'`);mplayer.style.setProperty('--ttmsg2', `'${toMin(aud.duration)}'`);mplayer.style.setProperty('--prog',`${100 * aud.currentTime / aud.duration}%`);});
            mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();</script>

南无月 发表于 2023-6-3 21:42

最新小播用上了。。。厉害。。。

醉美水芙蓉 发表于 2023-6-3 21:47

南无月 发表于 2023-6-3 21:42
最新小播用上了。。。厉害。。。

啊呀!月儿播放器出问题了呢?不知道怎么解决呢?

南无月 发表于 2023-6-3 21:49

醉美水芙蓉 发表于 2023-6-3 21:47
啊呀!月儿播放器出问题了呢?不知道怎么解决呢?

我看到歌词跟着转,晕啊晕。。
我也不知道怎么整啊。。。{:4_173:}

醉美水芙蓉 发表于 2023-6-3 21:50

@马黑黑 老师播放器歌词变成旋转的了,不会改了!

醉美水芙蓉 发表于 2023-6-3 21:52

南无月 发表于 2023-6-3 21:49
我看到歌词跟着转,晕啊晕。。
我也不知道怎么整啊。。。

真的整晕了!呵呵!

红影 发表于 2023-6-3 22:31

这个歌词怎么转起来?

亦是金 发表于 2023-6-3 22:38

去掉代码@keyframes rot { to { transform: rotate(1turn); } }
就不头晕了!{:4_189:}

亦是金 发表于 2023-6-3 22:39

再将歌词定位到合适的位置!

亦是金 发表于 2023-6-3 23:29

本帖最后由 亦是金 于 2023-6-3 23:33 编辑

我再试了试,进行下面的修改,就可以达到播放器正常转动或停止,歌词不再绕大圆了。

亦是金 发表于 2023-6-4 00:08

另:将歌词中的   &apos;   改为单引号'   
例如:You&apos;re   改为You're

醉美水芙蓉 发表于 2023-6-4 05:45

红影 发表于 2023-6-3 22:31
这个歌词怎么转起来?

不会改了!

醉美水芙蓉 发表于 2023-6-4 05:46

亦是金 发表于 2023-6-3 23:29
我再试了试,进行下面的修改,就可以达到播放器正常转动或停止,歌词不再绕大圆了。

谢谢老师指点迷津!

樵歌 发表于 2023-6-4 11:26

转动起来也不错{:4_173:}

醉美水芙蓉 发表于 2023-6-4 11:42

樵歌 发表于 2023-6-4 11:26
转动起来也不错

樵歌中午好!

梦缘 发表于 2023-6-4 16:11

很漂亮,欣赏点赞!{:4_187:}

醉美水芙蓉 发表于 2023-6-4 16:15

梦缘 发表于 2023-6-4 16:11
很漂亮,欣赏点赞!

谢谢朋友支持!

红影 发表于 2023-6-4 19:26

醉美水芙蓉 发表于 2023-6-4 05:45
不会改了!

亦是金老师不是讲了么。

马黑黑 发表于 2023-6-4 19:41

醉美水芙蓉 发表于 2023-6-3 21:50
@马黑黑 老师播放器歌词变成旋转的了,不会改了!

我最近见到一个翻转的歌词同步,不过没转那么厉害,也是挺好的呢

醉美水芙蓉 发表于 2023-6-4 19:46

马黑黑 发表于 2023-6-4 19:41
我最近见到一个翻转的歌词同步,不过没转那么厉害,也是挺好的呢

问候黑黑老师晚上好!感谢老师百忙之中光临指导!
页: [1] 2 3
查看完整版本: 你是我的愛 ,我的生命