网页-前端-练习题: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;
  }

}
复制代码

>>:👁👁

 

-------------------------------------------------------------------------------------------------

 

posted @   大序列  阅读(49)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· 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
点击右上角即可分享
微信分享提示