木琴弹奏效果
代码语言:html
所属分类:多媒体
代码描述:木琴弹奏效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
*, *:before, *:after {
box-sizing: border-box;
}
:root {
--desired-size: 40;
--coefficient: 1vmin;
--size: calc(var(--desired-size) * var(--coefficient));
}
body {
background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
height: 100vh;
display: grid;
place-items: center;
margin: 0;
font-family: sans-serif;
}
main {
margin: 0;
}
.xylophone {
display: -webkit-box;
display: flex;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
position: relative;
height: calc(1.2 * var(--size));
width: calc(2.5 * var(--size));
margin: 0 auto;
}
.xylophone > .note:before,
.xylophone > .note:after,
.xylophone:before,
.xylophone:after{
position: absolute;
content: '';
}
.xylophone:before,
.xylophone:after {
height: 30px;
z-index: -1;
width: 100%;
left: 0;
background-image: -webkit-gradient(linear, left top, right top, from(#434343), to(black));
background-image: linear-gradient(to right, #434343 0%, black 100%);
}
.xylophone:before {
top: 10%;
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
.xylophone:after {
bottom: 10%;
-webkit-transform: rotate(-4deg);
transform: rotate(-4deg);
}
.xylophone .note {
--primary-color: hsla(var(--h, 0), 100%, 50%, 1);
--offset: calc(var(--i, 0) * 4%);
position: relative;
height: calc(110% - var(--offset));
width: 10%;
background: var(--primary-color);
border-radius: 5px;
-webkit-transform: translateY(-15px);
transform: translateY(-15px);
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
-webkit-transition: all 1s ease;
transition: all 1s ease;
}
.xylophone > .note:before,
.xylophone > .note:after {
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
height: 15px;
width: 15px;
border-radius: 50%;
background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
box-shadow: 0 10.........完整代码请登录后点击上方下载按钮下载查看
网友评论0