div+css实现蜜蜂活体动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现蜜蜂活体动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#noise {
position: absolute;
opacity: 0.3;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(var(--sceneGrad2), var(--sceneGrad1));
color: white;
overflow: hidden;
--bugBodyGrad1: #823800;
--bugBodyGrad2: #6a6fff;
--antler: #5f63e5;
--sceneGrad1: #a454ff;
--sceneGrad2: #6effe4;
}
#container {
position: relative;
}
#cicada {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
mix-blend-mode: hard-light;
z-index: 2;
transform-origin: center;
}
#cicada-body {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
#head {
width: 6rem;
height: 6rem;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
transform: translateX(-50%);
top: -60%;
background: radial-gradient(#823800, #6a6fff);
clip-path: polygon(
50% 5%,
75% 10%,
95% 30%,
90% 70%,
75% 90%,
50% 100%,
25% 90%,
10% 70%,
5% 30%,
25% 10%,
50% 5%
);
z-index: 3;
animation: wiggle-head 5s infinite ease-in-out;
}
#antlers {
position: absolute;
top: -6rem;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
width: 100%;
gap: 4rem;
z-index: 10;
}
.antler {
position: absolute;
width: 2rem;
height: 4rem;
transform-origin: bottom center;
background: transparent;
}
/* Left Antler */
#antler-left {
border-left: 0.3rem solid #5f63e5;
border-bottom: 0.3rem solid #5f63e5;
top: 2rem;
left: 25%;
transform: translate(-50%, -50%) rotate(160deg);
transform-origin: top;
animation: wiggle-antler-left 1s infinite ease-in-out;
}
/* Right Antler */
#antler-right {
border-right: 0.3rem solid #5f63e5;
border-bottom: 0.3rem solid #5f63e5;
top: 2rem;
left: 75%;
transform: translate(-50%, -50%) rotate(-160deg);
transform-origin: top;
animation: wiggle-antler-right 1s infinite ease-in-out;
}
#eyes {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 35%;
width: 100%;
position: absolute;
transform: scale(1);
top: -50%;
z-index: 6;
animation: pulse 5s infinite ease-in-out;
}
#eye-left {
background: radial-gradient(#ffccff, #ff66cc);
position: relative;
width: 1.5rem;
height: 1.5rem;
clip-path: polygon(
30% 0%,
70% 0%,
100% 30%,
100% 70%,
70% 100%,
30% 100%,
0% 70%,
0% 30%
);
}
#eye-right {
background: radial-gradient(#ffccff, #ff66cc);
position: relative;
width: 1.5rem;
height: 1.5rem;
clip-path: polygon(
30% 0%,
70% 0%,
100% 30%,
100% 70%,
70% 100%,
30% 100%,
0% 70%,
0% 30%
);
}
#iris-left {
background: #6a6fff;
position: absolute;
top: 25%;
left: 25%;
transform: translate(-50%, -50%);
width: 0.5rem;
height: 0.5rem;
clip-path: polygon(
30% 0%,
70% 0%,
100% 30%,
100% 70%,
70% 100%,
30% 100%,
0% 70%,
0% 30%
);
}
#iris-right {
background: #6a6fff;
position: absolute;
top: 25%;
left: 75%;
transform: translate(-50%, -50%);
width: 0.5rem;
height: 0.5rem;
clip-path: polygon(
30% 0%,
70% 0%,
100% 30%,
100% 70%,
70% 100%,
30% 100%,
0% 70%,
0% 30%
);
}
#torso {
position: relative;
display: flex;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
justify-content: center;
align-items: center;
flex-direction: column;
width: 8rem;
height: 10rem;
background: radial-gradient(#823800, #6a6fff);
clip-path: polygon(
50% 20%,
50% 20%,
80% 25%,
90% 40%,
90% 60%,
80% 80%,
50% 100%,
20% 80%,
10% 60%,
10% 40%,
20% 25%
);
z-index: 3;
animation: wiggle-torso 1s infinite ease-in-out;
}
#stomach {
position: absolute;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
display: fle.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0