css偷鸡蛋交互效果
代码语言:html
所属分类:动画
代码描述:css偷鸡蛋交互效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
:root {
--sizeVar: clamp(100px, 20vw, 50vh);
}
body {
background-color: black;
overflow: hidden;
}
div,
a {
position: absolute;
}
.chickenDiv {
width: 20vw;
width: var(--sizeVar);
height: 20vw;
height: var(--sizeVar);
bottom: 20%;
left: 50%;
margin-left: -10vw;
margin-left: calc(var(--sizeVar) / -2);
-webkit-animation: none 300ms linear;
animation: none 300ms linear;
}
.chickenDiv,
.chickenDiv:focus,
.chickenDiv:active {
-webkit-tap-highlight-color: transparent;
}
.bgDiv {
width: 110%;
height: 110%;
left: 0%;
top: -10%;
border-radius: 50%;
background-color: rgb(2, 0, 36);
background: -webkit-gradient(
linear,
left bottom, left top,
from(rgba(2, 0, 36, 1)),
color-stop(35%, rgba(80, 9, 121, 1)),
to(rgba(239, 0, 255, 1))
);
background: linear-gradient(
0deg,
rgba(2, 0, 36, 1) 0%,
rgba(80, 9, 121, 1) 35%,
rgba(239, 0, 255, 1) 100%
);
z-index: -2;
}
.chickenDiv::after,
.chickenDiv::before {
position: absolute;
content: "";
width: 80%;
height: 15%;
left: 10%;
border-radius: 50%;
}
.chickenDiv::after {
bottom: -7%;
-webkit-clip-path: polygon(0 54%, 100% 54%, 100% 100%, 0% 100%);
clip-path: polygon(0 54%, 100% 54%, 100% 100%, 0% 100%);
border-bottom: 2vw solid rgb(117, 80, 56);
border-bottom: calc(var(--sizeVar) / 10) solid rgb(117, 80, 56);
}
.chickenDiv::before {
bottom: -2%;
background-color: rgb(95, 62, 41);
}
body a:nth-of-type(2) {
left: 20%;
}
body a:nth-of-type(3) {
left: 80%;
}
.chickenBody {
width: 80%;
height: 60%;
bottom: 0;
left: 10%;
background-color: whitesmoke;
border-radius: 50% 0 50% 50%;
border-radius: 50% 50% 50% 50% / 50% 20% 80% 50%;
-webkit-animation: reverseChicken 300ms linear;
animation: reverseChicken 300ms linear;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
pointer-events: none;
}
.chickenBody .chickenHead {
height: 50%;
width: 40%;
border-radius: 50%;
left: -15%;
top: 0;
background-color: whitesmoke;
-webkit-animation: reverseHead 400ms linear;
animation: reverseHead 400ms linear;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.chickenBody .chickenCrest,
.chickenBody .chickenCrest::after,
.chickenBody .chickenCrest::before {
width: 30%;
height: 30%;
background-color: red;
top: -30%;
-webkit-transform: translate(100%, 20%) scale(1, 1);
transform: translat.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0