css+js实现带声效开关控制6个灯泡点亮效果代码

代码语言:html

所属分类:布局界面

代码描述:css+js实现带声效开关控制6个灯泡点亮效果代码

代码标签: css js 声效 开关 控制 灯泡 点亮

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #222;
}



.light {
    position: relative;
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.box {
    position: absolute;
    left: 0;
    width: 80px;
    height: 80px;
    transform-origin:250px;
    transform: rotate(calc(60deg * var(--i)));
}

.box::before {
    content: '______________';
    position: absolute;
    top: 3px;
    font-size: 2em;
    text-decoration: underline;
    text-decoration-style: wavy ;
}

.bulb {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    background: #444;
    border-radius: 50%;
    transform: rotate(90deg);
}

.on .bulb {
    box-shadow: 0 0 50px #fff,
    0 0 100px #fff,
    0 0 150px #fff,
    0 0 200px #fff,
    0 0 300px #fff,
    0 0 350px #fff;
}

.bulb::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 22.5px;
    width: 35px;
    height: 80px;
    background: #444;
    border-top: 30px solid #000;
    border-radius: 10px;
    z-index: 10000;
}

.on .bulb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 120px;
    height: 120px;
    background: #fff;
    border-radius: 50%;
    filter: blur(40px);
}

.on .bulb,
.on .bulb::before {
    background: #fff;
}

.bulb span:nth-child(1) {
   position: absolute;
   top: -16px;
   left: -4px;
   width: 30px;
   height: 30px;
   background:transparent;
   border-bottom-right-radius: 40px;
   transform: rotate(342deg);
   box-shadow: 20px 20px 0 10px #444;
}

.bulb span:nth-child(2) {
    position: absolute;
    top: -16px;
    right: -4px;
    width: 30px;
    height: 30px;
    background:transparent;
    border-bottom-left-radius: 40px;
    transform: rotate(16.5deg);
    box-shadow: -20px 20px 0 10px #444;
 }

.on .bulb span:nth-child(1) {
    box-shadow: 20px 20px 0 10px #fff;
}

.on .bulb span:nth-child(2) {
    box-shadow: -20px 20px 0 10px #fff;
}

.switch {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid #000;
    background-image: linear-gradient(#eee,#ccc,#eee);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.switch ..........完整代码请登录后点击上方下载按钮下载查看

网友评论0