css实现电池电量不足与充足表情动画效果代码

代码语言:html

所属分类:布局界面

代码描述:css实现电池电量不足与充足表情动画效果代码

代码标签: css 电池 电量 不足 充足 表情 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<style>
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  background-color: #7FFF7F;
}

.cell {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: auto;
}

.battery__happy {
  background-color: #7FFF7F;
}
.battery__happy .face {
  border-color: #7FFF7F;
  border-radius: 0px 0px 15px 15px;
  background-color: #7FFF7F;
  height: 10px;
  animation: anim-happy 1.5s infinite;
}
.battery__happy .face:before, .battery__happy .face:after {
  background-color: #7FFF7F;
}
.battery__happy .acid {
  height: 220px;
}
.battery__happy .acid:after {
  background-color: #7FFF7F;
}

.battery__sad {
  background-color: #FF7F7F;
}
.battery__sad .face {
  border-color: #FFF transparent transparent transparent;
  border-radius: 50%;
  height: 30px;
  animation: anim-sad 5s infinite;
}
.battery__sad .face:before, .battery__sad .face:after {
  animation-delay: 1.3s;
  background-color: #FFF;
}
.battery__sad .acid {
  height: 50px;
}
.battery__sad .acid:after {
  background-color: #FF7F7F;
}

.battery {
  position: relative;
  width: 130px;
  height: 250px;
  border: 4px solid #FFF;
  border-radius: 25px;
  margin: auto;
}
.battery:after {
  position: absolute;
  top: -18px;
  left: 45px;
  width: 40px;
  height: 10px;
  background-color: #FFF;
  border-radius: 5px 5px 0px 0px;
  content: "";
}

.face {
  z-index: 1;
  margin: 100px auto 0px auto;
  width: 30px;
  border-style: solid;
  border-width: 4px;
  position: relative;
}
.face:before, .face:after {
  top: -20px;
  position: absolute;
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: blink 10s infinite;
}
.face:before {
  right: 0px;
}
.face:after {
  left: 0px;
}

.acid {
  display: block;
  position: absolute;
  bottom: 0;
  width: calc(130px - (2.........完整代码请登录后点击上方下载按钮下载查看

网友评论0