three实现圆环状小人开门跑步倒计时效果代码

代码语言:html

所属分类:其他

代码描述:three实现圆环状小人开门跑步倒计时效果代码,倒计时走动,门越开越大,小人也越来越模糊。

代码标签: three 圆环 小人 开门 跑步 倒计时

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

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

<head>
  <meta charset="UTF-8">
  

  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

/* Base Styles */
html, body {
  overflow: hidden;
  height: 100dvh;
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  background-color: #202124;
}

/* Countdown Timer Styles */
.timer {
  font-size: 2rem;
  letter-spacing: 0.4rem;
  text-shadow: #202124 0 0 10px;
  text-align: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  z-index: 2;
  opacity: 0.6;
}

.card {
  position: fixed;
  width: 250px;
  height: 250px;
  top: 50%;
  left: 50%;  
  transform: translate(-50%, -50%);
background: rgba( 50, 50, 50, 0.15 );
  box-shadow: 0 8px 32px 0 rgba( 30, 30, 30, 0.37 );
  backdrop-filter: blur( 18px );
  -webkit-backdrop-filter: blur( 18px );
  border: 1px solid rgba( 255, 255, 255, 0.18 );
  border-radius: 1rem;
  color: whitesmoke;
  z-index: 1;
}

.timer p{
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  line-height: 1rem;
  margin: 0;
}

#seconds {
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg) scale(2.5);
  z-index: 2;
}

.ring circle {
  fill: none;
}

.ring-background {
  stroke: #101112;
  filter: drop-shadow(0 0 0.75rem white);
  stroke-width: 1.75;
  opacity: 0.5;
}

.ring-progress {
  stroke: #fff;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-width: 2;
}

.timer svg{
  position: absolute;
  z-index: 1;
}

a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: all 0.5s ease-in-out;
}

a:hover{
  filter: drop-shadow(0px 0px 10px rgba(255, 255, 255, 0.9));
}

/* 3D Scene Canvas */
#canvas{
  height: 100%;
  width: 100%;
  z-index: 0;
/*   filter: blur(8px);*/
}

.text-container{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    top: 10%;
    height: 80%;
    width: 100%;
    position: fixed;
    left: 0;
    z-index: 2;
}

.title{
  font-size: 0.5rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
}

.socials{
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.socials svg{
    margin: 0 5px;
    transition: all 0.5s ease-in-out;
    transform: scale(1);
}

.socials svg:hover{
    transform: scale(1.2);
  filter: drop-shadow(0px 0px 5px rgba(255, 255, 255, 1));
}
</style>


<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.139.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/CopyShader.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/LuminosityHighPassShader.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/RGBELoader.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/EffectComposer.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/RenderPass.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/AfterimagePass.111.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/AfterimageShader.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/UnrealBloomPass.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/ShaderPass.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/inflate.min.js"></script>
  <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/FBXLoader.js"></script>
  
</head>

<body translate="no">
  <!-- Countdown Timer -->
<div class="timer">
    <svg class="ring" width="100" height="100">
      <circle class="ring-background" cx="50" cy="50" r="40"></circle>
      <circle class="ring-progress" cx="50" cy="50" r="40"></circle>
    </svg>
  <p>STREAM<br>STARTS IN</p>
    <span id="minutes">00</span>:<span id="seconds">00</span>
  </div>

<!-- Information Card -->
<div class="card">
  
</div>

<!-- Text Container for Social Media Links -->
 <div class="text-container">
  <div class="title">Title
    <br>
    <a href="" target="_blank">@auther</a>
    </div>
   
  </div>

<!-- 3D Scene Canvas -->
<canvas id="canvas"></canvas>
  
      <script  type="module">
// Define countdown time in minutes and seconds
const countdownTime = {
  minutes: 15,
  seconds: 0 };


// Initialize variables for 3D scene parameters
let initialFogDensity = 0.003;
let initialCameraZ = 100;
let initialWallWidth = 10;

// Start time for the countdown, initially null
let startTime = null;

// Start the countdown and update UI elements accordingly
function startCountdown() {

  // Convert countdown time to total seconds
  let totalSeconds = countdownTime.minutes * 60 + countdownTime.seconds;

  // Select the ring progress element and get its initial stroke offset
  const ringProgress = document.querySelector('.ring-progress');
  const initialRingOffset = parseFloat(getComputedStyle(ringProgress).getPropertyValue('stroke-dasharray'));

  // Mark the current time a.........完整代码请登录后点击上方下载按钮下载查看

网友评论0