Tone+skrollr实现滚动鼠标弹奏钢琴效果代码
代码语言:html
所属分类:其他
代码描述:Tone+skrollr实现滚动鼠标弹奏钢琴效果代码,利用skrollr来捕获滚动,利用Tone来模拟钢琴发声。
代码标签: Tone skrollr 滚动 鼠标 弹奏 钢琴
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background: #000;
}
body .background {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image: url(//repo.bfw.wiki/bfwrepo/icon/62abac9d2c755.gif);
background-size: cover;
background-position: center;
opacity: 0.15;
}
.mask {
position: fixed;
top: calc(50% - 0.1rem);
left: 0;
height: 0.2rem;
width: 100%;
background: rgba(255, 255, 255, 0.05);
z-index: 7;
}
#container {
padding: 50vh 0 60vh;
box-sizing: border-box;
position: relative;
z-index: 8;
}
#autoscroll,
#current-chord {
font-weight: light;
position: fixed;
bottom: 1rem;
line-height: 1;
z-index: 10;
font-size: 20px;
font-weight: 100;
}
#autoscroll {
cursor: pointer;
text-decoration: none;
transition: opacity 500ms ease-out, color 500ms ease-out;
color: white;
left: 50%;
transform: trnaslateX(-50%);
}
#autoscroll::after {
position: absolute;
left: 50%;
bottom: 0;
width: 200px;
text-align: center;
display: block;
transform: translateX(-50%);
content: "Enable Auto Scroll";
}
#autoscroll.active {
color: rgba(255, 255, 255, 0.2);
}
#autoscroll.active::after {
content: "Enable Manual Scroll";
}
#autoscroll:hover {
color: rgba(255, 255, 255, 0.5);
}
#current-chord {
color: rgba(255, 255, 255, 0.5);
right: 1rem;
}
section {
position: relative;
margin: 2rem auto;
width: 98%;
}
section.active span {
transform: scaleX(1.4);
}
section._1_32 {
height: 7vh;
}
section._2_32 {
height: 14vh;
}
section._3_32 {
height: 21vh;
}
section._4_32 {
height: 28vh;
}
section._5_32 {
height: 35vh;
}
section._6_32 {
height: 42vh;
}
section._7_32 {
height: 49vh;
}
section._8_32 {
height: 56vh;
}
section._9_32 {
height: 63vh;
}
section._10_32 {
height: 70vh;
}
section._11_32 {
height: 77vh;
}
section._12_32 {
height: 84vh;
}
section._13_32 {
height: 91vh;
}
section._14_32 {
height: 98vh;
}
section._15_32 {
height: 105vh;
}
section._16_32 {
height: 112vh;
}
section._17_32 {
height: 119vh;
}
section._18_32 {
height: 126vh;
}
section._19_32 {
height: 133vh;
}
section._20_32 {
height: 140vh;
}
section._21_32 {
height: 147vh;
}
section._22_32 {
height: 154vh;
}
section._23_32 {
height: 161vh;
}
section._24_32 {
height: 168vh;
}
section._25_32 {
height: 175vh;
}
section._26_32 {
height: 182vh;
}
section._27_32 {
height: 189vh;
}
section._28_32 {
height: 196vh;
}
section._29_32 {
height: 203vh;
}
section._30_32 {
height: 210vh;
}
section._31_32 {
height: 217vh;
}
section._32_32 {
height: 224vh;
}
section span, section div {
transition: transform 100ms ease-in-out;
}
section span {
position: absolute;
width: 0.5208333333%;
top: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.05);
color: white;
transition: background 250ms ease-in-out, box-shadow 250ms ease-out;
}
section span.C2 {
left: 0.5208333333%;
box-shadow: 0px 0px 12px rgba(230, 26, 26, 0);
}
section.active span.C2 {
background: #e61a1a;
box-shadow: 0px 0px 12px #e61a1a;
}
section span.Db2 {
left: 2.6041666667%;
box-shadow: 0px 0px 12px rgba(230, 51, 26, 0);
}
section.active span.Db2 {
background: #e6331a;
box-shadow: 0px 0px 12px #e6331a;
}
section span.D2 {
left: 4.6875%;
box-shadow: 0px 0px 12px rgba(230, 77, 26, 0);
}
section.active span.D2 {
background: #e64d1a;
box-shadow: 0px 0px 12px #e64d1a;
}
section span.Eb2 {
left: 6.7708333333%;
box-shadow: 0px 0px 12px rgba(230, 102, 26, 0);
}
section.active span.Eb2 {
background: #e6661a;
box-shadow: 0px 0px 12px #e6661a;
}
section span.E2 {
left: 8.8541666667%;
box-shadow: 0px 0px 12px rgba(230, 128, 26, 0);
}
section.active span.E2 {
background: #e6801a;
box-shadow: 0px 0px 12px #e6801a;
}
section span.F2 {
left: 10.9375%;
box-shadow: 0px 0px 12px rgba(230, 153, 26, 0);
}
section.active span.F2 {
backgroun.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0