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) {
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0