css+js实现点击摇动蜂巢蜜蜂跟随鼠标飞舞交互动画效果代码

代码语言:html

所属分类:动画

代码描述:css+js实现点击摇动蜂巢蜜蜂跟随鼠标飞舞交互动画效果代码

代码标签: css js 点击 摇动 蜂巢 蜜蜂 跟随 鼠标 飞舞 交互 动画

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

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

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

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&display=swap");
body {
  display: flex;
  justify-content: center;
  margin: 0;
  height: 100vh;
  background-color: #F5FCCD;
  overflow: hidden;
  cursor: none;
}

.hive-line {
  position: absolute;
  width: 0.2rem;
  height: 3rem;
  background-color: #12486B;
  box-shadow: 2rem -0.5rem 1rem 0 rgba(0, 0, 56, 0.5);
}
.hive-line--provoked {
  transform-origin: 50% -2rem;
  animation: swing;
  animation-duration: 1s;
  animation-iteration-count: 2;
}
@keyframes swing {
  0%, 100% {
    transform: rotate(0deg);
  }
  33.33% {
    transform: rotate(-10deg);
  }
  66.66% {
    transform: rotate(10deg);
  }
}

.hive-text {
  position: absolute;
  top: 1rem;
  left: calc(50vw - 8rem);
  width: 5rem;
  font-family: "Archivo Black", sans-serif;
  color: #12486B;
}
.hive-text:before {
  content: "";
  position: absolute;
  bottom: -2rem;
  left: 3rem;
  width: 0.2rem;
  height: 2rem;
  background-color: #12486B;
  transform: rotate(-45deg);
}

.hive {
  position: relative;
  width: 8rem;
  height: 10rem;
  margin-top: 3rem;
  border-radius: 50%;
  background: radial-gradient(circle at 0 0, #FFF -20%, orange);
  overflow: hidden;
  box-shadow: 2rem 1rem 2rem 0 rgba(0, 0, 56, 0.5);
}
.hive--provoked {
  transform-origin: 50% -4rem;
  animation: swing;
  animation-duration: 1s;
  animation-iteration-count: 2;
}
@keyframes swing {
  0%, 100% {
    transform: rotate(0deg);
  }
  33.33% {
    transform: rotate(-10deg);
  }
  66.66% {
    transform: rotate(10deg);
  }
}
.hive__division {
  position: absolute;
  width: 100%;
  height: 0.2rem;
  background: linear-gradient(90deg, #ff7d66, #000038 300%);
}
.hive__division:nth-child(1) {
  top: 10%;
}
.h.........完整代码请登录后点击上方下载按钮下载查看

网友评论0