网页-前端-练习题:Pac-man
吃豆豆网页小动画练习题
>>Html......
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="和尚" content="Pac-man"> <title>Pack-mantitle> <link rel="stylesheet" type="text/css" href="css/Pac-man.css"> head> <body class="Pac_manbgc"> <div class="mouth"> <div class="topmouth">div> <div class="buttommouth">div> div> body> html>
>>css......
/*设置背景颜色*/
.Pac_manbgc {
background-color: #000000;
}
/*吃豆人上半部分css*/
.topmouth {
margin-left: 200px;
margin-top: 0;
width: 200px;
height: 100px;
background-color: yellow;
border: 1px dashed yellow;
/*设置圆角*/
border-radius: 100px 100px 0 0;
/* csss变换 旋转(度数 deg 周期)
transform: rotate(-30deg);*/
/*播放动画 动画名称 时间 速度(匀速) 循环*/
animation: toppac-man 1s linear infinite;
}
/*吃豆人下半部分CSS*/
.buttommouth {
margin-left: 200px;
margin-top: 0;
width: 200px;
height: 100px;
background-color: yellow;
border: 1px dashed yellow;
/*设置圆角*/
border-radius: 0 0 100px 100px;
/* !*css3变换 旋转(角度 deg 周期)*!
transform: rotate(30deg);*/
/*播放动画 动画名称 时间 速度(默认匀速) 循环*/
animation: buttompac-man 1s linear infinite;
}
/*上半部分动画 关键帧设置*/
@keyframes toppac-man {
/*初始状态关键帧*/
0% {
transform: rotate(0deg);
}
/*中间状态关键帧*/
50% {
transform: rotate(-30deg);
}
/*结束状态关键帧*/
100% {
transform: rotate(0deg);
}
}
/*下半部分动画关键帧设置*/
@keyframes buttompac-man {
/*初始状态关键帧*/
0% {
transform: rotate(0deg);
}
/*中间状态关键帧*/
50% {
transform: rotate(30deg);
}
/*结束状态关键帧*/
100% {
transform: rotate(0deg);
}
}
/*pac-man吃的豆豆*/
.mouth {
width: 200px;
height: 200px;
/*background-color: rosybrown;*/
margin-top: 50px;
margin-left: 10px;
border: 0;
border-radius: 100px 100px;
/*box-shadow:X轴偏移量 Y轴偏移量 [阴影模糊半径] [阴影扩展] [阴影颜色] [投影方式];*/
/*1*/
box-shadow: 600px 0 0 -80px yellow,
500px 0 0 -80px yellow,
400px 0 0 -80px yellow,
300px 0 0 -80px yellow;
/*播放动画*/
animation: pea 1s linear infinite;
}
@keyframes pea {
0% {
box-shadow: 600px 0 0 -80px yellow,
500px 0 0 -80px yellow,
400px 0 0 -80px yellow,
300px 0 0 -80px yellow;
}
100% {
box-shadow: 500px 0 0 -80px yellow,
400px 0 0 -80px yellow,
300px 0 0 -80px yellow,
200px 0 0 -80px yellow;
}
}
>>:👁👁
-------------------------------------------------------------------------------------------------
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix