css+div实现圣诞彩灯挂在绳子上开关效果代码

代码语言:html

所属分类:布局界面

代码描述:css+div实现圣诞彩灯挂在绳子上开关效果代码

代码标签: css div 圣诞 彩灯 挂在 绳子 开关

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

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

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

  
  
  
<style>
body {
  margin: 0;
  background:#000;
}

.lamp {  
  height: 20px;
  width: 20px;
  background: red;
  border-radius: 20px 0 20px;
  transform-origin: 100% 0%;
  animation-name: swing;
  animation-duration:500ms;
  animation-direction: alternate;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  float: left;
}

@keyframes swing {
  0% {
    transform: rotate(-40deg);
  }
  100% {
    transform: rotate(-50deg);
  }  
}

.switch {
  position: fixed;
  bottom: 0px;
  left: 50%;
  height: 80px;
  width: 80px;
  cursor: pointer;
  font-family: arial;
  border-radius: 10px;
  background: #aaa;
}


.cable {
  position: fixed;
}
</style>


  
</head>

<body translate="no">
  <svg class="cable" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
  <path d="M -150 0 Q 0 100 170 0" stroke="#fff" fill="transparent"/>
  <path d="M 170 0 Q 300 100 460 0" stroke="#fff" fill="transparent"/>
  <path d="M 460 0 Q 600 100 750 0" stroke="#fff" fill="transparent"/>
  <path d="M 750 0 Q 900 100 1050 0" stroke="#fff" fill="transparent"/>
  <path d="M 1050 0 Q 1200 100 1340 0" stroke="#fff" fill="transparent"/>
  <path d="M 1340 0 Q 1460 100 1640 0" stroke="#fff" fill="transparent"/>
  <path d="M 1650 0 Q 1800 100 1910 0" stroke="#fff" fill="transparent"/>
</svg>



<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lamp"></div>
<div class="lam.........完整代码请登录后点击上方下载按钮下载查看

网友评论0