div+css模拟蚂蚁爬行飞行动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css模拟蚂蚁爬行飞行动画效果代码

代码标签: div css 模拟 蚂蚁 爬行 飞行 动画

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

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

<head>

  <meta charset="UTF-8">

  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Quicksand:wght@700&amp;display=swap'>
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #000;
  min-height: 100vh;
  filter: invert(100%);
  overflow: hidden;
}

.ant {
  position: absolute;
  display: flex;
  align-items: center;
  transform: scale(0.5);
  left: 0;
}
.ant:has(.ant__wing) {
  transform: scale(0.5) rotate(-20deg);
  animation: animate-move-with-wings 5s linear infinite;
}
@keyframes animate-move-with-wings {
  0% {
    left: 0;
    top: -10%;
  }
  50% {
    left: 55%;
    top: 55%;
  }
  90% {
    left: 100%;
    top: 50%;
  }
  100% {
    left: 100%;
    top: 50%;
  }
}
.ant:not(:has(.ant__wing)) {
  bottom: 0;
  animation: animate-move-with-legs 10s linear infinite;
}
@keyframes animate-move-with-legs {
  0% {
    left: -250px;
  }
  100% {
    left: 100%;
  }
}
.ant span {
  display: inline-block;
}
.ant__head {
  width: 70px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid.........完整代码请登录后点击上方下载按钮下载查看

网友评论0