js+css实现小人跟随音乐跳舞动画效果代码
代码语言:html
所属分类:动画
代码描述:js+css实现小人跟随音乐跳舞动画效果代码,点击播放音乐开始。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
background-size: 400% 400%;
animation: gradientBG 10s ease infinite;
overflow: hidden;
}
.dance-text {
font-family: 'Arial Black', sans-serif;
font-size: 4rem;
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
margin-bottom: 50px;
}
.dancer {
position: relative;
width: 150px;
height: 200px;
}
.dancer-part {
position: absolute;
background: white;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
}
.head {
width: 60px;
height: 60px;
left: 45px;
top: 0;
animation: headMove 1s ease-in-out infinite;
}
.body {
width: 20px;
height: 80px;
left: 65px;
top: 60px;
}
.arm {
width: 70px;
height: 20px;
top: 70px;
}
.left.arm {
left: -30px;
transform-origin: right center;
animation: armSwingLeft 1s ease-in-out infinite;
}
.right.arm {
right: -30px;
transform-origin: left center;
animation: armSwingRight 1s ease-in-out infinite;
}
.leg {
width: 20px;
height: 90px;
top: 140px;
}
.left.leg {
left: 45px;
animation: legKickLeft 1.2s ease-in-out infinite;
}
.right.leg {
left: 85px;
animation: legKickRight 1.2s ease-in-out infinite;
}
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% {.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0