雨中悄然 发表于 2023-3-15 21:52

【太阳当空照】(学习黑师熊猫小播效果作业)




<style>
#papa {
      --state: paused;
      margin: -10px 0 0 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 #fff;
      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-15 21:53

@马黑黑 {:4_170:}交一份作业,分随便打啊

马黑黑 发表于 2023-3-15 21:55

这个好

100√

雨中悄然 发表于 2023-3-15 21:56

这个么,加图片,加视频,加歌词, 这个是个综合练习贴{:4_187:}

雨中悄然 发表于 2023-3-15 21:57

马黑黑 发表于 2023-3-15 21:55
这个好

100√

{:4_199:}还好没扣分。撤了啊

马黑黑 发表于 2023-3-15 22:00

雨中悄然 发表于 2023-3-15 21:57
还好没扣分。撤了啊

{:4_187:}

大猫咪 发表于 2023-3-15 22:16

好制作!画面真可爱,太阳当空着,爱学习爱劳动 ,长大要为人民立功{:4_173:}

大猫咪 发表于 2023-3-15 22:20

马黑黑 发表于 2023-3-15 22:00


嘿嘿立功了没{:4_189:}

亦是金 发表于 2023-3-15 22:23

好制作,值得打100√{:4_187:}

小辣椒 发表于 2023-3-15 22:26

悄然,你基本功其实挺扎实的{:4_199:}

小辣椒 发表于 2023-3-15 22:27

好漂亮的制作,全方位的优秀作业,赞的{:4_199:}

红影 发表于 2023-3-15 22:37

这个太可爱了,想到把这个小简笔画放到书包上,悄然小脑袋太灵了{:4_199:}

红影 发表于 2023-3-15 22:38

非常童趣的制作,还有个花潮的小表情呢,放在这个帖子里特别和谐呢{:4_173:}

马黑黑 发表于 2023-3-15 23:11

大猫咪 发表于 2023-3-15 22:20
嘿嘿立功了没

哪有那么好的事

起个网名好难 发表于 2023-3-16 08:31

欣赏美帖

简笔画的白框隐去或许也行

大猫咪 发表于 2023-3-16 15:39

马黑黑 发表于 2023-3-15 23:11
哪有那么好的事

黑黑必须要立功{:5_117:}

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

大猫咪 发表于 2023-3-16 15:39
黑黑必须要立功

这个难上加难

雨中悄然 发表于 2023-3-16 17:47

马黑黑 发表于 2023-3-15 22:00


这一天天的太快了。今天好啊

雨中悄然 发表于 2023-3-16 17:47

大猫咪 发表于 2023-3-15 22:16
好制作!画面真可爱,太阳当空着,爱学习爱劳动 ,长大要为人民立功

谢谢临帖肯定{:4_187:}

雨中悄然 发表于 2023-3-16 17:48

亦是金 发表于 2023-3-15 22:23
好制作,值得打100√

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