gsap+three实现带声音高科技开屏首页导航菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:gsap+three实现带声音高科技开屏首页导航菜单效果代码

代码标签: gsap three 声音 高科技 开屏 首页 导航 菜单 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
  
<style>
@font-face {
  font-family: "PPSupplyMono";
  src: url("//repo.bfw.wiki/bfwrepo/font/PPSupplyMono-Regular.ttf")
    format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color--background: rgb(60, 60, 60);
  --color--foreground: #c4d5bc;
  --color--accent: rgb(170, 170, 170);
  --font-primary: "PPSupplyMono", "Courier New", monospace;
  --font-secondary: "PPSupplyMono", "Courier New", monospace;
  --margin: 32px;
  --gutter: 16px;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  background: radial-gradient(
    circle at 10% 20%,
    rgb(230, 230, 230) 0%,
    rgb(180, 180, 180) 45%,
    rgb(100, 100, 100) 90%
  );
  color: var(--color--foreground);
  letter-spacing: -0.03em;
  position: relative;
  overflow: hidden;
}

body.loading-active {
  overflow: hidden !important;
}

body::before {
  content: "";
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: transparent
    url("//repo.bfw.wiki/bfwrepo/icon/684a2870e3948.png") repeat 0 0;
  background-size: 300px 300px;
  -webkit-animation: noise-animation 0.3s steps(5) infinite;
          animation: noise-animation 0.3s steps(5) infinite;
  opacity: 0.9;
  will-change: transform;
  z-index: 100;
  pointer-events: none;
}

@-webkit-keyframes noise-animation {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-2%, -3%);
  }

  20% {
    transform: translate(-4%, 2%);
  }

  30% {
    transform: translate(2%, -4%);
  }

  40% {
    transform: translate(-2%, 5%);
  }

  50% {
    transform: translate(-4%, 2%);
  }

  60% {
    transform: translate(3%, 0);
  }

  70% {
    transform: translate(0, 3%);
  }

  80% {
    transform: translate(-3%, 0);
  }

  90% {
    transform: translate(2%, 2%);
  }

  100% {
    transform: translate(1%, 0);
  }
}

@keyframes noise-animation {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-2%, -3%);
  }

  20% {
    transform: translate(-4%, 2%);
  }

  30% {
    transform: translate(2%, -4%);
  }

  40% {
    transform: translate(-2%, 5%);
  }

  50% {
    transform: translate(-4%, 2%);
  }

  60% {
    transform: translate(3%, 0);
  }

  70% {
    transform: translate(0, 3%);
  }

  80% {
    transform: translate(-3%, 0);
  }

  90% {
    transform: translate(2%, 2%);
  }

  100% {
    transform: translate(1%, 0);
  }
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  background: transparent;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

#canvas.ready {
  opacity: 1;
}

.fallback-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("//repo.bfw.wiki/bfwrepo/image/5fc02c7657770.png");
  background-size: cover;
  background-position: center;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s ease-out;
}

.fallback-bg.active {
  opacity: 1;
}

.container {
  display: flex;
  width: 100%;
  height: 100vh;
  padding: var(--gutter);
  position: relative;
  z-index: 10;
  transition: filter 0.1s ease-out;
}

.text-element {
  position: fixed;
  font-family: var(--font-primary);
  color: var(--color--foreground);
  text-transform: uppercase;
  z-index: 10;
  opacity: 0;
  transform: translateY(30px);
}

.audio-enable {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  font-family: var(--font-primary);
  font-size: 12px;
  color: #c4d5bc;
  text-transform: uppercase;
  gap: 2rem;
  text-align: center;
  padding: 1rem;
}

.enable-button {
  border: 1px solid #c4d5bc;
  background: transparent;
  color: #c4d5bc;
  padding: 1rem 2rem;
  font-family: var(--font-primary);
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.3s ease;
}

.enable-button:hover {
  background: #c4d5bc;
  color: #0a0a0a;
}

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0a0a0a;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  font-family: var(--font-primary);
  font-size: 12px;
  color: #c4d5bc;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 1;
  transition: opacity 0.8s ease-out;
}

.preloader.fade-out {
  opacity: 0;
}

.error-message {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  padding: 10px;
  font-size: 12px;
  display: none;
  z-index: 3000;
}

.description {
  top: 120px;
  left: 50px;
  width: 360px;
  font-size: 0.75rem;
  line-height: 1.2;
}

.nav-links {
  top: 50%;
  left: 50px;
  transform: translateY(-50%);
}

.nav-links a {
  position: relative;
  display: block;
  margin-bottom: 8px;
  color: var(--color--foreground);
  text-decoration: none;
  z-index: 1;
  transition: color 0.3s ease;
  padding: 4px 8px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: var(--color--foreground);
  z-index: -1;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  color: #1a1a1a;
}

.footer {
  bottom: 120px;
  right: 50px;
  font-size: 0.625rem;
}

.division {
  bottom: 120px;
  left: 50px;
  font-size: 0.625rem;
}

.signal {
  top: 50%;
  right: 100px;
  font-size: 0.625rem;
  transform: translateY(-50%);
}

.central-text {
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.1;
  white-space: nowrap;
  width: -webkit-max-content;
  width: -moz-max-content;
  width: max-content;
}

.dg.ac {
  z-index: 3000 !important;
  position: fixed !important;
  top: 10px !important;.........完整代码请登录后点击上方下载按钮下载查看

网友评论0