js+css实现一个机器狗跟随音乐跳舞动画代码
代码语言:html
所属分类:动画
代码描述:js+css实现一个机器狗跟随音乐跳舞动画代码
代码标签: js css 机器狗 跟随 音乐 跳舞 动画 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
align-items: center;
display: flex;
height: 100vh;
justify-content: center;
margin: 0;
background: linear-gradient(
0deg,
rgba(158, 217, 198, 1) 0%,
rgba(158, 217, 198, 1) 40%,
rgba(199, 255, 221, 1) 40%,
rgba(199, 255, 221, 1) 100%
);
}
body[onload] > *,
body[onload] > * *,
body.play-animation > *,
body.play-animation > * * {
animation-play-state: running;
}
body[onload] audio {
display: none;
}
.container {
position: relative;
font-size: clamp(8px, 2vmin, 17px);
}
.arm-wrapper,
.arm-2,
.spot-body,
.details,
.top-leg-1,
.bottom-leg-1,
.top-leg-2,
.bottom-leg-2,
.top-leg-3,
.bottom-leg-3,
.top-leg-4,
.bottom-leg-4,
.shadow {
animation-duration: 1s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-play-state: paused;
}
.arm-wrapper {
animation-name: moveBody;
}
.arm-wrapper > * {
position: absolute;
}
.spot-arm {
background: #262626;
height: 2.3em;
}
.arm-base {
border-radius: 15% 0% 58% 0% / 15% 0% 58% 0%;
left: 14em;
top: -1.4em;
transform: rotate(1deg);
width: 10em;
}
.arm-1 {
border-radius: 0% 58% 0% 58% / 0% 58% 0% 58%;
left: 13.2em;
top: -3.7em;
transform: rotate(11deg);
width: 11em;
}
.arm-2 {
animation-name: moveArm3;
border-radius: 58% 0% 0% 0% / 58% 0% 0% 0%;
left: 13.4em;
top: -6em;
width: 13em;
}
@keyframes moveArm3 {
0%,
100% {
top: -7em;
transform: rotate(-10deg);
}
10%,
25% {
top: -6em;
transform: rotate(1deg);
}
35%,
50% {
top: -7em;
transform: rotate(-10deg);
}
60%,
75% {
top: -6em;
transform: rotate(1deg);
}
85%,
95% {
top: -7em;
transform: rotate(-10deg);
}
}
.circle {
background: grey;
border-radius: 50%;
height: 1.9em;
left: 10em;
position: abs.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0