快乐果农(学习黑师路径课程作业一)
<style>#papa {
margin: -80px 0 0 calc(50% - 593px);
width: 1024px;
height: 640px;
background: tan url('https://s1.ax1x.com/2023/05/26/p9q0QnH.md.jpg')no-repeat center/cover;
box-shadow: 0 0 8px #000;
display: grid;
place-items: center;
position: relative;
overflow: hidden;
--state: paused;
}
.panda {
position: absolute;
width: 476px;
height: 402px;
top: 240px;
left: 510px;
cursor: pointer;
z-index: 2;
transform: rotate(8deg);
transform-origin: 100px 10px;
animation: rot 1s infinite alternate linear var(--state);
}
@keyframes rot { to { transform: rotate(12deg); } }
css-doodle { position: absolute; }</style>
<div id="papa">
<css-doodle grid="1" id="mplayer">:
doodle {@size: 1024px 640px;
background: url('') no-repeat center/cover;
box-shadow: 0 0 6px #000;
position: relative;
margin: 20px auto;
z-index: 1;}
@size: 60px;
clip-path: @shape(points: 360;
scale: .3;
move: 0 .6;
x: sin(5t) + sin(t) + tan.sin(3t);
y: cos(2t) + cos(t) + tan.cos(6t);rotate: 90;);
position: absolute;
background: WhiteSmoke;
offset-path: path('M0 60 Q300 200,400 180 T850 10');
animation: move 20s infinite linear var(--state);
cursor: pointer;@keyframes move { to { offset-distance: 100%;} }
</css-doodle>
<css-doodle id="lrc">
:doodle {
@size: auto 4em;
z-index:5;
bottom: 10px; --geci: "css-doodle player"; --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="https://pic1.imgdb.cn/item/6470a83ff024cca173b6f3e7.png" alt="" /></div> <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1422182335" 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> @马黑黑 老师来瞧瞧,路径作业,入门哈{:4_173:} 把 d 路径放到 offset-path 里来,不错 这播放器图形还真的像小飞机呢,月儿把自己头像都拿出来做帖子了啊{:4_187:} 这样的场景真悠闲呢,好自在。看到是路径学习一,看样子后面还有啊{:4_199:} 好帖!{:4_187:}{:4_187:}{:4_187:} 马黑黑 发表于 2023-5-26 22:30
把 d 路径放到 offset-path 里来,不错
黑黑辛苦{:4_187:}{:4_190:} 红影 发表于 2023-5-26 23:01
这播放器图形还真的像小飞机呢,月儿把自己头像都拿出来做帖子了啊
这个图好看,拿来当素材用一下{:4_187:} 红影 发表于 2023-5-26 23:02
这样的场景真悠闲呢,好自在。看到是路径学习一,看样子后面还有啊
对路径一无所知,现在刚入门哈,后面应该有的吧 醉美水芙蓉 发表于 2023-5-26 23:40
月儿很聪明,我都看不懂呢?
谢谢水芙蓉夸奖{:4_187:} 焱鑫磊 发表于 2023-5-27 00:12
好帖!
感谢临贴支持{:4_187:} 醉美水芙蓉 发表于 2023-5-27 17:10
月儿好悠闲啊!
{:4_170:}嗯哪,很自在。这就是世界上最好的头像 南无月 发表于 2023-5-27 21:20
黑黑辛苦
辛苦的应该不是我 马黑黑 发表于 2023-5-27 21:41
辛苦的应该不是我
{:4_173:}是我吧 南无月 发表于 2023-5-27 21:44
是我吧
对 马黑黑 发表于 2023-5-27 21:45
对
这事不提醒不晓得,后知后觉{:4_173:} 南无月 发表于 2023-5-27 21:21
这个图好看,拿来当素材用一下
是啊,用来做飞行器真的很不错的呢{:4_199:} 南无月 发表于 2023-5-27 21:22
对路径一无所知,现在刚入门哈,后面应该有的吧
月儿加油,你一定行的{:4_178:}