js+css实现夜晚悬挂的灯泡摆动动画倒影效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现夜晚悬挂的灯泡摆动动画倒影效果代码

代码标签: 悬挂 灯泡 摆动 动画 倒影 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
  
  
<style>
*, *::after, *::before {
  box-sizing: border-box;
}

body {
  background: #001933;
}

.container {
  width: 75px;
  height: 275px;
  animation: bulb-swing 3s infinite ease-in-out;
  transform-origin: top center;
  position: absolute;
  top: 0;
  left: calc(50% - (75px/2));
}

.container.paused {
  animation-play-state: paused;
}

.bulb {
  z-index: 10;
  display: block;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  position: absolute;
  top: 200px;
  left: calc(50% - (75px/2));
  background: #FFD700;
  box-shadow: 5px 5px 80px gold, 5px -5px 80px gold, -5px 5px 80px gold, -5px -5px 80px gold;
  cursor: pointer;
}
.bulb::before {
  content: "";
  position: absolute;
  width: 35px;
  height: 50px;
  background: black;
  bottom: 100%;
  left: calc(50% - (35px/2));
  z-index: -1;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
.bulb::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 250px;
  background: black;
  bottom: 100%;
  left: calc(50% - 5px);
  z-index: -1;
}
.bulb .filaments {
  display: block;
  position: absolute;
  width: 2px;
  height: 30px;
  background: black;
  top: 2px;
  left: 28px;
  box-shadow: 17px 0 black;
  opacity: 0;
}
.bulb .filaments::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 4px;
  background: black;
  width: 2px;
  height: 12px;
  display: block;
  box-shadow: 4.5px 0 black, 9px 0 black;
}

.bulb.off {
  background: transparent;
  box-shadow: none;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0