起个网名好难 发表于 2023-3-17 18:22

本帖最后由 起个网名好难 于 2023-3-17 18:24 编辑 <br /><br />雨中悄然 发表于 2023-3-17 17:57
不会吧

看, 完全你的代码就改个框的颜色
<style>
#papa {
      --state: paused;
      margin: 10px 0 32px calc(50% - 593px);
      width: 1024px;
      height: 640px;
      background: lightgreen url('https://s1.ax1x.com/2023/03/15/pp3QGCt.jpg') center/cover no-repeat;
      box-shadow: 3px 3px 20px #000;
      display: grid;
      place-items: center;
      position: relative;
}
#mypic {
        position: absolute;
        left: 300px;
        top: 400px;
}
#vid {
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 2%;
        opacity: .2;
        object-fit: cover;
        pointer-events: none;
}
#lrc {
      --motion: cover2;
      --tt: 2s;
      --bg: linear-gradient(180deg, hsla(60, 50%, 50%, .45), hsla(80, 70%, 50%, .65));
      position: absolute;
      top: 20px;
      font: bold 2em sans-serif;
      color: snow;
      white-space: pre;
      -webkit-background-clip: text;
      filter: drop-shadow(1px 1px 2px hsla(0, 0%, 0%, .95));
}
#lrc::before {
      position: absolute;
      content: attr(data-lrc);
      width: 20%;
      height: 100%;
      color: transparent;
      overflow: hidden;
      white-space: pre;
      background: var(--bg);
      filter: inherit;
      -webkit-background-clip: text;
      animation: var(--motion) var(--tt) linear forwards;
      animation-play-state: var(--state);
}
#face {
      position: absolute;
      top: 380px;
      width: 85px;
      height: 85px;
      border: 1px solid transparent;
      border-radius: 100% 100% 80% 80%;
      cursor: pointer;
}
#face > span {
      position: absolute;
      top: 30px;
      width: 10px;
      height: 16px;
      border-radius: 50%;
      background: #000;
}
#face > span:nth-of-type(1) {
      left: 20px;
      animation: mov .5s infinitealternate var(--state);
      --xx: 10px;
}
#face > span:nth-of-type(2) {
      left: 70px;
      animation: mov .5s infinite linear alternate var(--state);
      --xx: -10px;
}
#face > span:nth-of-type(3) {
      height: 8px;
      background: none;
      border: 1px solid #000;
      top: 60px;
      left: 45px;
      transform: scale(.5);
      animation: scale .15s infinite alternate var(--state);
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes mov {to { transform: translate(var(--xx)); } }
@keyframes scale { to {transform: scale(1.5); } }
</style>

<div id="papa"><img id="mypic" src="https://www.huachaowang.com/static/image/smiley/hcbiaoqing2/128.jpg" alt="" /><video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/01/92/5b4df20fcfa7d_10s_big.mp4" autoplay="" loop="" muted=""></video>
      <audio id="aud" src="https://music.163.com/song/media/outer/url?id=475073509.mp3" loop autoplay></audio>
      <div id="lrc" data-lrc="HCPlayer">HCPlayer</div>
      <div id="face">
                <span></span>
                <span></span>
                <span></span>
</div>
</div>

<script>
let averAdd = 0, offset = 0, mKey = 0, mFlag = true;

let lrcTime = (ar) => {let tmpAr = [];for (j = 0; j < ar.length - 1; j++) {if (j !== ar.length - 1) tmpAr = parseFloat((ar - ar).toFixed(1));}let aver = parseInt(tmpAr.reduce((a, b) => a + b) / (tmpAr.length - 1)) + averAdd;tmpAr.push(aver);tmpAr.forEach((item, key) => {ar = item > aver ? aver : item;});return ar;};
let getLrcAr = (text) => {let lrcAr = [];let calcRule = ;for (x of text.split('\n')) {let ar = [];let re = /\d+[\.:]\d+([\.:]\d+)?/g;let geci = x.replace(re, '');if (geci) {geci = geci.replace(/[\[\]\'\"\t,]s?/g, '');let time = x.match(re);if (time != null) {for (y of time) {let tmp = y.match(/\d+/g);let sec = 0;for (z in tmp) sec += tmp * calcRule;ar = ;lrcAr.push(ar);}}}}lrcAr.sort((a, b) => a - b);return (lrcTime(lrcAr));}
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');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 time = lrcAr - (aud.currentTime - lrcAr); showLrc(time); };
let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');

let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
aud.addEventListener('timeupdate', () => {for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime >= lrcAr) {cKey = j;if (mKey === j) showLrc(lrcAr);else continue;}}});
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
face.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
</script>

马黑黑 发表于 2023-3-17 18:58

雨中悄然 发表于 2023-3-17 18:00
体现男生对战争的向往

向往的是奖励{:5_117:}

马黑黑 发表于 2023-3-17 18:58

雨中悄然 发表于 2023-3-17 17:59
又忙得够呛。黑色黑期五

你这还好。我天天忙。

无尘 发表于 2023-3-17 20:01

真会玩呢,好玩

红影 发表于 2023-3-17 20:48

雨中悄然 发表于 2023-3-17 17:56
可爱的花潮小表情我喜爱

可爱的悄然我也最爱{:4_189:}

红影 发表于 2023-3-17 20:49

雨中悄然 发表于 2023-3-17 17:56
趣味十足

每次看到这个小播,都会忍不住笑出来{:4_173:}

雨中悄然 发表于 2023-3-17 23:10

起个网名好难 发表于 2023-3-17 18:22
本帖最后由 起个网名好难 于 2023-3-17 18:24 编辑

看, 完全你的代码就改个框的颜色


{:4_199:}

雨中悄然 发表于 2023-3-17 23:12

马黑黑 发表于 2023-3-17 18:58
向往的是奖励

对呀,一回事{:4_170:}

雨中悄然 发表于 2023-3-17 23:13

马黑黑 发表于 2023-3-17 18:58
你这还好。我天天忙。

是啊,我还算行。周末只能休一天{:4_170:}

雨中悄然 发表于 2023-3-17 23:14

无尘 发表于 2023-3-17 20:01
真会玩呢,好玩

这是一份学习作业贴{:4_187:}

雨中悄然 发表于 2023-3-17 23:14

红影 发表于 2023-3-17 20:48
可爱的悄然我也最爱

爱花潮,爱影宝{:4_187:}

雨中悄然 发表于 2023-3-17 23:15

红影 发表于 2023-3-17 20:49
每次看到这个小播,都会忍不住笑出来

乐呵呵的好{:4_187:}

马黑黑 发表于 2023-3-17 23:26

雨中悄然 发表于 2023-3-17 23:13
是啊,我还算行。周末只能休一天

我连周末都木有

马黑黑 发表于 2023-3-17 23:26

雨中悄然 发表于 2023-3-17 23:12
对呀,一回事

差不多

红影 发表于 2023-3-18 10:21

雨中悄然 发表于 2023-3-17 23:14
爱花潮,爱影宝

我又加了2个小表情,还有这个{:4_431:}

红影 发表于 2023-3-18 10:22

雨中悄然 发表于 2023-3-17 23:15
乐呵呵的好

这个童趣的歌曲更是每次听了都心情好好{:4_205:}

红影 发表于 2023-3-18 10:22

马黑黑 发表于 2023-3-17 23:26
我连周末都木有

黑黑辛苦了{:4_190:}

马黑黑 发表于 2023-3-18 11:17

红影 发表于 2023-3-18 10:22
黑黑辛苦了

为人民服务

红影 发表于 2023-3-18 12:56

马黑黑 发表于 2023-3-18 11:17
为人民服务

口号喊得真响{:4_170:}

马黑黑 发表于 2023-3-18 15:34

红影 发表于 2023-3-18 12:56
口号喊得真响

{:4_181:}
页: 1 2 [3] 4 5
查看完整版本: 【太阳当空照】(学习黑师熊猫小播效果作业)