css实现会眨眼摆动耳朵的可爱小狗效果代码
代码语言:html
所属分类:动画
代码描述:css实现会眨眼摆动耳朵的可爱小狗效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=KoHo:wght@700&display=swap" rel="stylesheet">
<style>
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
-webkit-tap-highlight-color: transparent;
appearance: none;
}
/***********************/
/***********************/
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
cursor: pointer;
overflow: hidden;
background-color: #cf9ef5;
}
/***********************/
.container {
display: flex;
justify-content: center;
align-items: center;
width: 60vw;
height: 45vw;
position: relative;
}
.text {
position: absolute;
left: 0;
top: 5vw;
font-size: 2.35vw;
font-family: "KoHo", sans-serif;
line-height: 1.2;
letter-spacing: 0.025vw;
text-transform: uppercase;
text-shadow: 0.35vw 0.15vw 0.1vw #b870f0;
color: #ffffff;
}
.puppy {
position: relative;
width: 29vw;
height: 35.5vw;
}
.head {
position: absolute;
top: 0;
left: 4.5vw;
width: 22.9vw;
height: 26.5vw;
animation: head-r 1500ms linear infinite alternate, head-t 350ms linear infinite alternate;
}
@keyframes head-r {
0%, 30% {
transform: rotateZ(-2deg);
}
50%, 70%, 100% {
transform: rotateZ(1deg);
}
}
@keyframes head-t {
to {
top: 0.2vw;
}
}
.ear-l,
.ear-r {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
width: 8vw;
height: 20vw;
border-radius: 50%;
border: 0.6vw solid #102770;
box-shadow: inset -0.3vw 0.2vw 0 #fcd7a9;
background-color: #f99b28;
}
.ear-l::before,
.ear-r::before {
content: "";
position: absolute;
width: 75%;
height: 80%;
border-radius: 50%;
border: 0.65vw solid #102770;
box-shadow: -0.3vw -0.1vw 0 #b3773d, inset 0.4vw 0.2vw 0 #dc106a;
background-color: #f02f84;
}
.ear-l {
left: 1.5vw;
transform: rotateZ(-10deg);
animation: ear-l 4000ms linear infinite alternate;
}
@keyframes ear-l {
0%, 30% {
transform: rotateZ(-10deg);
}
37%, 70% {
transform: rotateZ(-3deg);
}
77%, 100% {
transform: rotateZ(-20deg);
}
}
.ear-r {
top: 1.5vw;
right: 2vw;
transform: rotateZ(25deg);
animation: ear-r 110ms linear infinite alternate;
}
@keyframes ear-r {
to {
transform: rotateZ(23deg);
}
}
.face {
position: absolute;
top: 5.5vw;
left: 0;
width: 20vw;
height: 20vw;
transform: rotateZ(10deg);
border-radius: 48% 52% 50% 50%/55% 55% 45% 45%;
border: 0.6vw solid #102770;
box-shadow: inset 0 0.4vw 0 #fcd7a9, inset 0 -0.85vw 0 #b7bed4;
background-image: linear-gradient(to bottom, #f99b28 38%, #ffffff 38%);
overflow: hidden;
}
.face__s1 {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-90%);
width: 2.5vw;
height: 6vw;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
background-color: #ffffff;
}
.face__s2, .face__s3 {
position: absolute;
top: calc(50% - 1.5vw);
width: 5vw;
height: 2vw;
background-color: #f99b28;
}
.face__s2 {
left: calc(50% - 6.05vw);
border-bottom-left-radius: 6vw;
border-bottom-right-radius: 3vw;
}
.face__s3 {
right: calc(50% - 5.95vw);
border-bottom-left-radius: 3vw;
border-bottom-right-radius: 6vw;
}
.face__s4, .face__s5 {
position: absolute;
bottom: 50%;
width: 9vw;
height: 4vw;
border-top-left-radius: 2vw;
border-top-right-radius: 2vw;
border-bottom-left-radius: 1.5vw;
border-bottom-right-radius: 1.5vw;
background-color: #f99b28;
}
.face__s4 {
border-bottom-right-radius: 2vw;
}
.face__s5 {
left: calc(100% - 9vw);
border-bottom-left-radius: 1.5vw;
}
.face__s6, .face__s7 {
position: absolute;
bottom: calc(50% - 1vw);
width: 2vw;
height: 1vw;
border-radius: 50%;
background-color: #ffffff;
}
.face__s6 {
left: 2.525vw;
}
.face__s7 {
right: 2.525vw;
}
.mouth-b {
position: absolute;
left: calc(50% - 2.75vw);
top: 48%;
width: 5.5vw;
height: 6vw;
border-radius: 50%;
background-color: #102770;
box-shadow: 0 0.85vw 0 #b7bed4;
}
.mouth-l,
.mouth-r {
position: absolute;
top: 47%;
width: 4vw;
height: 4vw;
border-radius: 50%;
border-bottom: 0.5vw solid #102770;
border-left: 0.5vw solid #102770;
border-top: 0.5vw solid transparent;
border-right: 0.5vw solid transparent;
background-color: #ffffff;
}
.mouth-l {
left: calc(50% - 2vw);
transform: translateX(-50%) rotateZ(-50deg);
box-shadow: inset 0 -0.5vw 0 #b7bed4;
}
.mouth-r {
right: calc(50% - 6vw);
transform: translateX(-50%) rotateZ(-40deg);
box-shad.........完整代码请登录后点击上方下载按钮下载查看
网友评论0