有声有色 发表于 2022-9-23 13:49

试试新电脑-OT红影老师乡愁——念秋

本帖最后由 有声有色 于 2025-9-16 13:15 编辑 <br /><br /><style>
        #papa { left: -302px; width: 1200px; height: 675px; background: #ccc url('https://pic1.imgdb.cn/item/664c29a0d9c307b7e9155bbb.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
        #mplayer { position: absolute; right: 60px; bottom: 30px; }
        #btnwrap { fill: snow; cursor: pointer; }
        #btnwrap:hover { fill: olive; }
        #tmsg { fill: snow; stroke: gray; stroke-width: 1px; font: bold 1em sans-serif; }
        #lrc { position: absolute; bottom: 250px; left: 680px; font: bold 2em sans-serif; color: transparent; letter-spacing: 2px; background: linear-gradient(-90deg, darkgreen, orange, tomato) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
        #hudie { position: absolute; left: 50px; top: 30px; }
.mazha { position: absolute; left: 400px; top: 0; width: 100px; transform: rotate(220deg); offset-distance: 0; offset-path: path("M250 250 Q140 220, 130 390 Q20 360, 10 530 Q-100 500, -110 670"); animation: move 4s linear infinite; }
@keyframes move { to { offset-distance: 100%;} }
        @keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
        @keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
</style>

<div id="papa">
      <img class="mazha" src="https://pic.imgdb.cn/item/632d192216f2c2beb11856ab.gif" alt="" />
        <img id="hudie" src="https://pic.imgdb.cn/item/62a09aa50947543129666cf8.gif" alt="" />
        <div id="lrc">花潮lrc在线</div>
        <svg id="mplayer" width="120" height="120">
                <g id="mama" transform="rotate(-90, 60, 60)" style="cursor: pointer">
                        <circle id="track" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="rgba(255,255,255,0.65)" />
                        <circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="6" stroke="rgba(57,54,81,0.85)" />
                </g>
                <g id="btnwrap">
                        <path id="btnplay" d="M 50 50,50 70,70, 60 z"></path>
                        <path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z" style="display:none"></path>
                        <path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" />
                </g>
                <path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none"/>
                <path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none"/>
                <g id="tmsg">
                        <text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text>
                        <text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text>
                </g>
        </svg>
</div>

<script>
let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
let mKey = 0, mFlag = true, aud = new Audio();
let cc = {
        x: 1*track.getAttribute('cx'),
        y: 1*track.getAttribute('cy'),
        r: 1*track.getAttribute('r'),
        len: track.getTotalLength(),
};

prog.style.strokeDasharray = prog.style.strokeDashoffset =cc.len;
aud.src = 'https://link.hhtjim.com/163/1470597929.mp3';
aud.autoplay = true;
aud.loop = true;

mama.onclick = (e) => {
        let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;
        deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;
        aud.currentTime = aud.duration * deg / 360;
};

btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();

aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());

aud.addEventListener('timeupdate', () => {
        prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;
        curMsg.textContent = toMin(aud.currentTime);
        durMsg.textContent = toMin(aud.duration);
        for(j=0; j<lrcAr.length; j++) {
                if(aud.currentTime >= lrcAr) {
                        if(mKey === j) showLrc(lrcAr);
                        else continue;
                }
        }
});

let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none',
lrc.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block',
lrc.style.animationPlayState = 'running');

let showLrc = (time) => {
        lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
        lrc.innerHTML = lrcAr;
        mKey += 1;
        mFlag = !mFlag;
}

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 mtime = lrcAr - (aud.currentTime - lrcAr);
        showLrc(mtime);
}

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;
}

</script>

有声有色 发表于 2022-9-23 13:55


有声有色 发表于 2022-9-23 13:57


有声有色 发表于 2022-9-23 14:01

加了这个代码还是不加这个代码,我的电脑上有很大的区别</div>
</div>
</div><div class="pct"><style type="text/css">.pcb{margin-right:0}</style><div class="pcb">

<div class="t_fsz">
<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_1720937">

梦缘 发表于 2022-9-23 15:19

漂亮,老师的帖很好看!{:4_187:}

有声有色 发表于 2022-9-23 15:31

梦缘 发表于 2022-9-23 15:19
漂亮,老师的帖很好看!

谢谢支持

红影 发表于 2022-9-23 15:42

有声有色 发表于 2022-9-23 14:01
加了这个代码还是不加这个代码,我的电脑上有很大的区别
没明白区别是什么。我们都不加的啊。你看我们的帖子的时候有问题么?

红影 发表于 2022-9-23 15:46

画面很漂亮,歌词同步也很准确,欣赏有声有色好帖{:4_187:}

有声有色 发表于 2022-9-23 15:54

红影 发表于 2022-9-23 15:42
没明白区别是什么。我们都不加的啊。你看我们的帖子的时候有问题么?

以编辑俩字为点,加了后编辑俩字在画的中间位置左右,不加,编辑这俩字在回复上面,这就是我为啥要加,老电脑是这样新电脑还是这样

有声有色 发表于 2022-9-23 15:58


这就是不加

有声有色 发表于 2022-9-23 15:59

编辑就在下一贴头像上面

红影 发表于 2022-9-23 16:16

有声有色 发表于 2022-9-23 15:54
以编辑俩字为点,加了后编辑俩字在画的中间位置左右,不加,编辑这俩字在回复上面,这就是我为啥要加,老 ...

要删就把所有其他的都删掉,只留黑黑的代码。
看到你最上面的删掉了,最下面多出来的东西没删,所以出现画面扭曲问题。
帮你删掉了最后面的,你再看看{:4_204:}

有声有色 发表于 2022-9-23 16:27

红影 发表于 2022-9-23 16:16
要删就把所有其他的都删掉,只留黑黑的代码。
看到你最上面的删掉了,最下面多出来的东西没删,所以出现 ...

这样行了,后面到</script>就可以了,谢谢又涨知识了。我把图片改了,你看看图片背景虚化了一下

红影 发表于 2022-9-23 16:31

有声有色 发表于 2022-9-23 16:27
这样行了,后面到就可以了,谢谢又涨知识了。我把图片改了,你看看图片背景虚化了一下

虚化与否,应该是仁者见仁的事,我是觉得虚化前后都好看{:4_187:}

东篱闲人 发表于 2022-9-23 16:48

好看!{:4_204:}

有声有色 发表于 2022-9-23 17:48

红影 发表于 2022-9-23 16:31
虚化与否,应该是仁者见仁的事,我是觉得虚化前后都好看

是的,主要使用了新版PS虚化背景方便多了

有声有色 发表于 2022-9-23 17:49

东篱闲人 发表于 2022-9-23 16:48
好看!

东篱闲人老师好,几天没见你作品了

红影 发表于 2022-9-23 20:40

有声有色 发表于 2022-9-23 17:48
是的,主要使用了新版PS虚化背景方便多了

正好可以牛刀小试了{:4_173:}

东篱闲人 发表于 2022-9-23 21:20

有声有色 发表于 2022-9-23 17:49
东篱闲人老师好,几天没见你作品了

最近没啥思路。。。{:5_117:}

马黑黑 发表于 2022-9-23 22:33

新电脑,新人,新帖{:4_170:}
页: [1] 2
查看完整版本: 试试新电脑-OT红影老师乡愁——念秋