div+csss实现4种方块伸缩loading加载动画效果代码

代码语言:html

所属分类:加载滚动

代码描述:div+csss实现4种方块伸缩loading加载动画效果代码

代码标签: div csss 方块 伸缩 loading 加载 动画

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
  
  
<style>
.container {
  width: fit-content;
  height: fit-content;
  position: absolute;
  margin: auto;
  inset: 0;
  border: 5px solid #555;
  padding: 10px;
  display: flex;
  gap: 10px;
}

.box1 {
  position: relative;
  width: 150px;
  height: 150px;
  background: #000;
  border: 10px solid #000;
}
.box1 .bar {
  width: 40px;
  height: 40px;
  background: #fff;
  position: absolute;
  animation: grow 1s infinite;
}
.box1 .bar:first-child {
  left: 0;
  top: 0;
}
.box1 .bar:nth-child(2) {
  inset: 0;
  margin: auto;
}
.box1 .bar:last-child {
  bottom: 0;
  right: 0;
}

@keyframes grow {
  0% {
    width: 40px;
    height: 40px;
  }
  25% {
    width: 100%;
    height: 40px;
  }
  50% {
    width: 40px;
    height: 40px;
  }
  75% {
    width: 40px;
    height: 100%;
  }
  100% {
    width: 40px;
    height: 40px;
  }
}
.box2 {
  position: relative;
  width: 150px;
  height: 150px;
  background: #000;
  border: 10px solid #000;
}
.box2 .bar {
  width: 40px;
  height: 100px;
  position: absolute;
  background: #fff;
  bottom: 0;
}
.box2 .bar:first-child {
  left: 0;
  animation: jump 1s infinite;
}
.box2 .bar:nth-child(2) {
  left: 0;
  right: 0;
  margin: auto;
  animation: jump 1s 0.3s infinite;
}
.box2 .bar:last-child {
  right: 0;
  animation: jump 1s 0.6s infinite;
}

@keyframes jump {
  0% {
    bottom: 0;
  }
  50% {
    bottom: 50px;
  }
  100% {
    bottom: 0;
  }
}
.box3 {
  position: relative;
  width: 150px;
  height: 150px;
  background: #000;
  border: 10px solid #000;
}
.box3 .bar {
  width: 40px;
  height: 0;
  position: absolute;
  background: #fff;
  top: 0;
}
.box3 .bar:first-child {
  left: 0;
  animation: drop 1s infinite alternate;
}
.box3 .bar:nth-child.........完整代码请登录后点击上方下载按钮下载查看

网友评论0