小辣椒 发表于 2022-9-24 21:29

羞答答的玫瑰静悄悄地开TO:黑黑


<style>
        #papa { left: -344px; width: 1280px; height: 680px; top: 150px; background: url('https://wj.zp68.com/lxx/yunhua/2022/09/24/1.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; box-shadow: 3px 3px 20px #000; overflow: hidden; position: relative; z-index: 1; }
        #mplayer { position: absolute; left: 10px; bottom: 10px; }
        #btnwrap { fill: snow; cursor: pointer; }
        #btnwrap:hover { fill: lightgreen; }
        #tmsg { fill: snow; stroke: gray; stroke-width: 1px; font: bold 1em sans-serif; }
        #lrc { position: absolute; left: 450px; bottom: 520px; font: bold 2.4em sans-serif; color: transparent; background: linear-gradient(-90deg,Red, transparent) 0 0 / 200% 200%; filter: drop-shadow(2px 2px 4px #666); background-clip: text; -webkit-background-clip: text; text-stroke: 1px lightgreen; -webkit-text-stroke: 1px white; }
        #heart { position: absolute; background: hsl(0,100%,30%); left: 1020px; top: 230px; height: 50px; width: 50px; transform: rotate(-60deg); animation: beat 0.8s infinite; }
        #heart::before { position: absolute; content: ''; background: inherit; width: 100%; height: 100%; border-radius: 50%; top: -25px; }
        #heart::after { position: absolute; content: ''; background: inherit; width: 100%; height: 100%; border-radius: 50%; left: 25px; }
        #face { position: absolute; left: 344px; top: 135px; width: 1px; height: 1px; background: #aaa; border-radius: 50%; }
        #face::before { position: absolute; content: ''; width: 100px; height: 40px; left: -40px; top: -50px; background: #1b1b1b; opacity: .8; animation: opa 4s linear infinite alternate;}
                #dt{ position: absolute; width: 150px; height: 150px; top: 170px; left: 960px; }

        @keyframes bgMove1 { to { background-position: -100% 0; } }
        @keyframes bgMove2 { to { background-position: -100% 0; } }
        @keyframes beat { to { transform: scale(1.05) rotate(-55deg); } }
        @keyframes opa { to { opacity: 0; } }
</style>

<div id="papa">
      <img id="dt" src="https://wj.zp68.com/lxx/yunhua/2022/09/24/1.png" alt="" />
        <span id="lrc">花潮lrc在线</span>
        <span id="face"></span>
        <span id="heart"></span>
        <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://wj.zp68.com/lxx/yunhua/2022/09/24/xdddmg.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 || 5);
                        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>
<br><br><br><br><br><br><br><br><br><br><br><br>

小辣椒 发表于 2022-9-24 21:29

@马黑黑
{:4_170:}{:4_189:}{:4_205:}

小辣椒 发表于 2022-9-24 21:30

黑黑~~~套用一个,献爱心{:4_172:}

小辣椒 发表于 2022-9-24 21:32

一面做一面笑,这个心脏跳动太激烈了

黑黑你太厉害了,纯代码做出一颗跳动的心脏{:4_178:}

小辣椒 发表于 2022-9-24 21:43

为了配合黑黑的这颗跳跃的心脏做了这首动感音乐{:4_170:}

醉美水芙蓉 发表于 2022-9-24 21:45

小辣椒 发表于 2022-9-24 21:45

谢谢岁月的粒子频谱{:4_179:}@走过岁月

红影 发表于 2022-9-24 21:46

亲爱的也把那颗动态心用上了,厉害,这个那么多动态元素,真漂亮{:4_199:}

小辣椒 发表于 2022-9-24 21:47

醉美水芙蓉 发表于 2022-9-24 21:45
红心好漂亮!谢谢辣椒分享!@马黑黑 快来看喔!

谢谢水芙蓉欣赏{:4_171:}

小辣椒 发表于 2022-9-24 21:48

红影 发表于 2022-9-24 21:46
亲爱的也把那颗动态心用上了,厉害,这个那么多动态元素,真漂亮

哈哈~~亲爱的,一面学习一面开心的玩{:4_172:}

马黑黑 发表于 2022-9-24 21:49

小辣椒 发表于 2022-9-24 21:29
@马黑黑

孟庭苇长酱紫呀

小辣椒 发表于 2022-9-24 21:51

马黑黑 发表于 2022-9-24 21:49
孟庭苇长酱紫呀

哈哈~~~认识一下{:4_189:}

马黑黑 发表于 2022-9-24 21:52

小辣椒 发表于 2022-9-24 21:51
哈哈~~~认识一下

不认识

小辣椒 发表于 2022-9-24 21:54

马黑黑 发表于 2022-9-24 21:52
不认识

岁月推出的美女{:4_189:}

小辣椒 发表于 2022-9-24 21:59

马黑黑 发表于 2022-9-24 21:52
不认识

黑黑,现在的歌词编辑器太给力了,一次成功,黑黑你非常的了不起{:4_178:}

小辣椒 发表于 2022-9-24 22:00

歌词直接进去出来就完美了~~,非常的棒,今天这个帖我就一次成功

马黑黑 发表于 2022-9-24 22:07

小辣椒 发表于 2022-9-24 21:59
黑黑,现在的歌词编辑器太给力了,一次成功,黑黑你非常的了不起

成不成功还得看个人操作

马黑黑 发表于 2022-9-24 22:08

小辣椒 发表于 2022-9-24 21:54
岁月推出的美女

没有逆生长?

小辣椒 发表于 2022-9-24 22:22

马黑黑 发表于 2022-9-24 22:07
成不成功还得看个人操作

反正我今天第一次用,一次成功

小辣椒 发表于 2022-9-24 22:23

马黑黑 发表于 2022-9-24 22:08
没有逆生长?

哈哈~~~问一下岁月了
页: [1] 2
查看完整版本: 羞答答的玫瑰静悄悄地开TO:黑黑