酒吧聚光灯效果

代码语言:html

所属分类:动画

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>Night Party Mode</title>
  <style>
      html, body{
  height: 100%;
  background: white;
  color: black;
  overflow: hidden;
  padding: 0px;
  margin: 0px;
  font-family: sans-serif;
}

#container{
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.beam{
  width: 8px;
  height: 2000px;
  position: absolute;
  background: red;
  box-shadow: 0px 0px 40px 10px red;
  display: none;
}

p{
  margin-top: 30px;
  font-size: 18px;
  line-height: 1.6em;
}

.bottom-light{
  width: 10px;
  height: 10px;
  background: red;
  border-radius: 100%;
  position: fixed;
  background-color: #fff;
  box-shadow:
    0px 0px 10px 10px white,
    0px 0px 30px 30px red,
    0px 100px 100px 100px rgba(255, 0, 0, .3);
}

#switch{
  color: white;
  background: black;
  font-size: 32px;
  font-weight: bold;
  padding: 8px 15px 8px 15px;
  border: none;
  border-radius: 5px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 70px;
  cursor: pointer;
  outline: none;

}

#disco-ball{
  max-width: 60px;
  position: absolute;
  display: none;
  user-select: none;
}
  </style>
</head>
<body>

<div id="container">
  <button id="switch" onClick="startParty()">
    切换到夜间聚会模式
  </button>
  <p>
    废话。这里只是一些普通的文本。你不讨厌这一页如此明亮和无聊吗?要是有解决办法就好了。一些大按钮解决方案。要填充页面的更多文本。 
  </p>
</div>

<div id="beam0" class="beam"></div>
<div id="beam1" class="beam"></div>
<div id="beam2" class="beam"></div>
<div id="beam3" class="beam"></div>
<div id="beam4" class="beam"></div>
<div id="beam5" class="beam"></div>
<div id="beam6" class="beam"></div>
<div id="beam7" class="beam"></div>

<img id="disco-ball" src="http://repo.bfw.wiki/bfwrepo/image/dancer.png"/>

<script >
let beams = [];
let lights = [];
let dancerSwitch = true;
let dancer = document.getElementById("disco-ball");


let colors = ["#ff7979", "#686de0", "#badc58", "#f6e58d", "#ffbe76", "#e056fd", "#7ed6df", "#dff9fb"];

for(let x = 0; x < 8; x++){
  beams.push(document.getElementById("beam" + x));
}

function startParty(){
  document.body.style = "background: black; color: white; cursor: none !important;";
  document.getElementById("switch").style = "pointer-events:none;"
  document.getElementById("switch").innerText = "已启用夜间聚会模式!"
  createLights();
  update();
  
  window.addEventListener("mousemove", function(e){
    mouseX = e.clientX;
    mouseY = e.clientY;
    let dancerTransform = ".........完整代码请登录后点击上方下载按钮下载查看

网友评论0