react+three打造支持键盘和声音输出的三维汉堡架子鼓弹奏效果代码
代码语言:html
所属分类:三维
代码描述:react+three打造支持键盘和声音输出的三维汉堡架子鼓效果代码,从面包汉堡拆封成架子鼓动画后,点击鼠标或键盘即可进行弹奏,有声音输出
代码标签: 键盘 和 声音 输出 的 三维 汉堡 架子 鼓 弹奏 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Metal+Mania&display=swap");
.App {
text-align: center;
display: flex;
width: 100%;
height: 100%;
}
.component-carousel {
position: absolute;
top: 20px;
right: 20px;
flex-direction: column;
display: flex;
align-items: center;
justify-content: center;
color: white;
text-decoration: none;
transition: transform 0.2s ease-in-out;
}
.component-carousel img {
width: 187px;
margin-top: 10px;
}
.component-carousel:hover {
text-decoration: underline;
}
.component-carousel:hover img {
transform: translate(2px, 2px);
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
color: white;
background-color: #142522;
font-family: sans-serif;
}
.burger-drum {
overflow: hidden;
position: relative;
}
.burger-drum .container {
width: 100vw;
max-width: 1800px;
height: 60vw;
min-height: 400px;
max-height: 100vh;
}
.info {
position: absolute;
bottom: 40px;
left: 40px;
width: 40vw;
max-width: 500px;
display: flex;
justify-content: center;
align-items: flex-start;
flex-direction: column;
transform: translateX(-50vw);
transition: transform 0.5s ease-in-out;
}
.presents {
margin-bottom: 20px;
}
.burger .info {
transform: translateX(0);
}
h1 {
font-family: "Metal Mania", cursive;
font-size: clamp(40px, 6vw, 100px);
letter-spacing: 5px;
margin: 0;
white-space: nowrap;
}
p {
text-align: left;
font-size: 20px;
margin-bottom: 40px;
/* letter-spacing: 0.03em; */
line-height: 130%;
}
button {
margin-right: 40px;
background-color: rgba(0, 0, 0, 0.3);
padding: 10px 30px;
border: solid 1px white;
color: white;
font-size: 30px;
/* text-transform: uppercase; */
letter-spacing: 3px;
font-family: "Metal Mania", cursive;
cursor: pointer;
outline: solid 1px transparent;
outline-offset: 0px;
transition-property: background-color, outline-offset, outline;
transition-duration: 0.1s;
transition-timing-function: ease-in-out;
}
button:hover:not(:disabled) {
background-color: darkred;
outline: solid 1px white;
outline-offset: 2px;
}
button:disabled {
opacity: 0.3;
}
.controls {
position: absolute;
bottom: 40px;
right: 40px;
width: calc(100% - 80px);
display: flex;
justify-content: space-between;
align-items: flex-end;
transform: translateY(200%);
transition: transform 0.5s ease-in-out;
}
.drums .controls {
transform: translateY(0%);
}
.loader {
position: absolute;
top: 50%;
left: 50%;
font-size: 50px;
font-family: "Metal Mania", cursive;
transform: translate(-50%, -50%);
pointer-events: none;
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
.loading .loader {
opacity: 10;
}
.controls span {
text-transform: uppercase;
padding: 2px;
display: inline-block;
border: 2px solid white;
border-bottom: 4px solid white;
border-radius: 6px;
width: 20px;
height: 20px;
margin-left: 10px;
}
</style>
</head>
<body >
<div id="root"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.17.1.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.17.1.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script>
<script type="text/javascript" s.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0