css布局实现三维探照灯灯塔旋转动画效果代码

代码语言:html

所属分类:动画

代码描述:css布局实现三维探照灯灯塔旋转动画效果代码

代码标签: 三维 探照灯 灯塔 旋转 动画 效果

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

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<style>
    *, *:before, *:after {
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-size: 16px;
}

body {
  background: #126;
  display: flex;
  height: 100vh;
  overflow-x: hidden;
}

.lighthouse {
  margin: auto;
  position: relative;
  width: 16.4em;
  height: 31.2em;
  perspective: 30em;
}

.lighthouse div {
  position: absolute;
}

.shadow {
  background: rgba(0, 0, 10, 0.15);
  width: 20%;
  height: 100%;
  z-index: 1;
}

.light-ray {
  animation: lightRay 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: linear-gradient(90deg, #ffff5c, rgba(255, 255, 92, 0));
  top: 3.3em;
  left: 8em;
  width: 14em;
  height: 1.5em;
  transform-origin: 0% 50%;
  z-index: 6;
}

.roof-tip {
  background: #464646;
  border-radius: 50%;
  left: 7.5em;
  width: 1em;
  height: 1em;
  z-index: 1;
}

.roof {
  background: linear-gradient(-30deg, #5a5a5a 59%, rgba(90, 90, 90, 0) 60%) 0 0/50.5% 100%, linear-gradient(30deg, #5a5a5a 59%, rgba(90, 90, 90, 0) 60%) 99.5% 0/50.5% 100%;
  background-repeat: no-repeat;
  border-radius: 0 0 10% 10%;
  top: 0.9em;
  left: 5.25em;
  width: 5.5em;
  height: 2em;
}

.head, .window1, .window2 {
  background: #dcdcdf;
}

.head, .upper-neck, .lower-neck, .stem, .base-bottom {
  overflow: hidden;
}

.head {
  border-radius: 50% 50% 0 0 / 20% 20% 0 0;
  top: 2.2em;
  left: 5.6em;
  width: 4.8em;
  height: 4em;
}

.light {
  animation: light 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: #ffff5c;
  border-radius: 50%;
  top: 0.6em;
  left: 1.4em;
  width: 2em;
  height: 2em;
}

.top-rail, .bottom-rail {
  color: #8c8c96;
}

.top-rail {
  border-radius: 50% 50% 0 0;
  box-shadow: 0 0 0 0.2em inset;
  top: 5em;
  left: 5.1em;
  width: 5.7em;
  height: 1.5em;
  z-index: 1;
}

.upper-neck {
  background: #5a5a5a;
  border-radius: 50% 50% 0 0 / 35% 35% 0 0;
  top: 5.7em;
  left: 5em;
  width: 6em;
  height: 2.2em;
  z-index: 2;
}

.bottom-rail {
  border-radius: 50%;
  box-shadow: 0 0 0 0.2em inset;
  top: 6.3em;
  left: 4.2em;
  width: 7.6em;
  height: 2em;
  z-index: 4;
}

.lower-neck {
  background: #464646;
  border-radius: 50% 50% 50% 50% / 25% 25% 50% 50%;
  top: 7.6em;
  left: 4em;
  width: 8em;
  height: 2.5em;
  z-index: 5;
}

.stem {
  border-radius: 50% 50% 50% 50% / 5% 5% 2% 2%;
  box-shadow: 2em 0 0 0 #000 inset;
  bottom: 1.7em;
  left: 3.4em;
  height: 27.3em;
  width: 9.2em;
  transform: rotateX(30deg);
  transform-origin: 50% 100%;
  z-index: 6;
}

.window1, .window2, .door {
  z-index: 1;
}

.window1, .window2 {
  animation: windows 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  border-radius: 50%;
  left: 3.7em;
  width: 2.5em;
  height: 2.5em;
}

.window1 {
  box-shadow: 0 0.3em 0 0 #a7a7ae inset;
  top: 3.5em;
}

.window2 {
  box-shadow: 0 0.2em 0 0 #9f0000 inset;
  top: 10em;
}

.door {
  animation: door 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: #222;
  border-radius: 1em 1em 0 0;
  box-shadow: -0.3em 0 0 0 #9f0000 inset;
  top: 23.5em;
  left: 6em;
  height: 4em;
  width: 2em;
}

.stem-texture {
  animation: texture 3s.........完整代码请登录后点击上方下载按钮下载查看

网友评论0