css+js实现城市夜晚马路路灯下雪花飞舞动画效果代码

代码语言:html

所属分类:动画

代码描述:css+js实现城市夜晚马路路灯下雪花飞舞动画效果代码

代码标签: css js 城市 夜晚 马路 路灯 雪花 飞舞 动画

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        .frame {
          position: relative;
          margin: auto;
          aspect-ratio: 1/1.5;
          height: 99%;
          background: linear-gradient(to bottom, #3E383A, #4D4A4E, #444452);
          overflow: hidden;
        }
        .frame .ambient {
          z-index: 1;
          position: absolute;
          background: yellow;
          inset: -35%;
          top: -56%;
          left: -29%;
          mask-image: radial-gradient(circle, #ffffffff, #ffffff66 13%, #ffffff00 100%);
          -webkit-mask-image: radial-gradient(circle, #ffffffff, #ffffff66 13%, #ffffff00 100%);
          opacity: 0.25;
        }
        .frame .weather {
          z-index: 1;
          position: absolute;
          inset: -2%;
          mask-image: radial-gradient(circle, #ffffffff, #ffffff66 13%, #ffffff33 30%, #ffffff11 100%);
          -webkit-mask-image: radial-gradient(circle, #ffffffff, #ffffff66 13%, #ffffff33 30%, #ffffff15 100%);
          top: -15%;
          left: -4%;
        }
        .frame .snow {
          z-index: 1;
          position: absolute;
          inset: 0;
        }
        .frame .snow .dot {
          height: 0.35vh;
          width: 0.35vh;
          max-width: 4px;
          max-height: 4px;
          border-radius: 40%;
          position: absolute;
          background: whitesmoke;
        }
        .frame [class^=bat] .level {
          padding-right: 6%;
          display: flex;
          align-items: center;
          justify-content: space-evenly;
          rotate: -16deg;
          margin-bottom: 27%;
        }
        .frame [class^=bat] .level .window {
          aspect-ratio: 1/1;
          background: #20181599;
          transform: skew(-10deg);
          width: 14%;
        }
        .frame [class^=bat] .level .window.tv {
          animation-name: watchingtv;
          animation-duration: 4s;
          animation-timing-function: linear;
          animation-iteration-count: infinite;
          box-shadow: 0 0 16px #7AABC6;
        }
        .frame [class^=bat] .level .window.yellow {
          background: #DF9A62AA !important;
          box-shadow: 0 0 16px #DF9A62;
        }
        .frame [class^=bat] .level .window.green {
          background: #67A796AA !important;
          box-shadow: 0 0 16px #67A796;
        }
        .frame [class^=bat] .level .window.white {
          background: #CDC4BCAA !important;
          box-shadow: 0 0 16px #CDC4BC;
        }
        .frame [class^=bat] .level .window.blue {
          background: #7AABC6AA !important;
          box-shadow: 0 0 16px #7AABC6;
        }
        .frame .bat-1 {
          position: absolute;
          right: -21%;
          bottom: 0;
          width: 45%;
          height: 80%;
          background: linear-gradient(to bottom, #201815, #2D2320);
          clip-path: polygon(13% 15%, 100% 0%, 100% 100%, 0% 100%);
        }
        .frame .bat-2 {
          rotate: -6deg;
          position: absolute;
          right: 2%;
          bottom: -10%;
          width: 23%;
          height: 80%;
          background: linear-gradient(to bottom, #3B3332, #483B3E);
          clip-path: polygon(0 6%, 69% 0%, 100% 100%, 0% 100%);
          filter: blur(0.5px);
          padding-top: 10%;
          padding-right: 6%;
          box-sizing: border-box;
        }
        .frame .bat-2 .level:nth-child(2) {
          width: calc(100% + 3.4%);
          rotate: calc(-14deg + 3.4deg);
        }
        .frame .bat-2 .level:nth-child(2) .window {
          transform: skew(calc(-14deg + 4deg));
        }
        .frame .bat-2 .level:nth-child(3) {
          width: calc(100% + 5.1%);
          rotate: calc(-14deg + 5.1deg);
        }
        .frame .bat-2 .level:nth-child(3) .window {
          transform: skew(calc(-14deg + 6deg));
        }
        .frame .bat-2 .level:nth-child(4) {
          width: calc(100% + 6.8%);
          rotate: calc(-14deg + 6.8deg);
        }
        .frame .bat-2 .level:nth-child(4) .window {
          transform: skew(calc(-14deg + 8deg));
        }
        .frame .bat-2 .level:nth-child(5) {
          width: calc(100% + 8.5%);
          rotate: calc(-14deg + 8.5deg);
        }
        .frame .bat-2 .level:nth-child(5) .window {
          transform: skew(calc(-14deg + 10deg));
        }
        .frame .bat-2 .level:nth-child(6) {
          width: calc(100% + 10.2%);
          rotate: calc(-14deg + 10.2deg);
        }
        .frame .bat-2 .level:nth-child(6) .window {
          transform: skew(calc(-14deg + 12deg));
        }
        .frame .bat-2 .level:nth-child(7) {
          width: calc(100% + 11.9%);
          rotate: calc(-14deg + 11.9deg);
        }
        .frame .bat-2 .level:nth-child(7) .window {
          transform: skew(calc(-14deg + 14deg));
        }
        .frame .bat-2 .level:nth-child(8) {
          width: calc(100% + 13.6%);
          rotate: calc(-14deg + 13.6deg);
        }
        .frame .bat-2 .level:nth-child(8) .window {
          transform: skew(calc(-14deg + 16deg));
        }
        .frame .bat-2 .level:nth-child(9) {
          width: calc(100% + 15.3%);
          rotate: calc(-14deg + 15.3deg);
        }
        .frame .bat-2 .level:nth-child(9) .window {
          transform: skew(calc(-14deg + 18deg));
        }
        .frame .bat-2 .level:nth-child(10) {
          width: calc(100% + 17%);
          rotate: calc(-14deg + 17deg);
        }
        .frame .bat-2 .level:nth-child(10) .window {
          transform: skew(calc(-14deg + 20deg));
        }
        .frame .bat-2 .level:nth-child(11) {
          width: calc(100% + 18.7%);
          rotate: calc(-14deg + 18.7deg);
        }
        .frame .bat-2 .level:nth-child(11) .window {
          transform: skew(calc(-14deg + 22deg));
        }
        .frame .bat-2 .level:nth-child(12) {
          width: calc(100% + 20.4%);
          rotate: calc(-14deg + 20.4deg);
        }
        .frame .bat-2 .level:nth-child(12) .window {
          transform: skew(calc(-14deg + 24deg));
        }
        .frame .bat-2 .level:nth-child(13) {
          width: calc(100% + 22.1%);
          rotate: calc(-14deg + 22.1deg);
        }
        .frame .bat-2 .level:nth-child(13) .window {
          transform: skew(calc(-14deg + 26deg));
        }
        .frame .bat-2 .level:nth-child(14) {
          width: calc(100% + 23.8%);
          rotate: calc(-14deg + 23.8deg);
        }
        .frame .bat-2 .level:nth-child(14) .window {
          transform: skew(calc(-14deg + 28deg));
        }
        .frame .bat-3 {
          rotate: 0deg;
          position: absolute;
          right: 12%;
          bottom: -10%;
          width: 40%;
          height: 75%;
          background: linear-gradient(to bottom, #494341, #493C3F);
          clip-path: polygon(0 10%, 69% 0%, 100% 100%, 0% 100%);
          filter: blur(1px);
          padding-top: 10%;
          padding-right: 15%;
          box-sizing: border-box;
        }
        .frame .bat-3 .level {
          rotate: -14deg;
          margin-bottom: 25%;
        }
        .frame .bat-3 .level .window {
          width: 10%;
          background: #20181560;
          transform: skew(-10deg);
        }
        .frame .bat-3 .level:nth-child(2) {
          width: calc(100% + 4%);
          rotate: calc(-14deg + 4deg);
        }
        .frame .bat-3 .level:nth-child(2) .window {
          transform: skew(calc(-14deg + 2deg));
        }
        .frame .bat-3 .level:nth-child(3) {
          width: calc(100% + 6%);
          rotate: calc(-14deg + 6deg);
        }
        .frame .bat-3 .level:nth-child(3) .window {
          transform: skew(calc(-14deg + 3deg));
        }
        .frame .bat-3 .level:nth-child(4) {
          width: calc(100% + 8%);
          rotate: calc(-14deg + 8deg);
        }
        .frame .bat-3 .level:nth-child(4) .window {
          transform: skew(calc(-14deg + 4deg));
        }
        .frame .bat-3 .level:nth-child(5) {
          width: calc(100% + 10%);
          rotate: calc(-14deg + 10deg);
        }
        .frame .bat-3 .level:nth-child(5) .window {
          transform: skew(calc(-14deg + 5deg));
        }
        .frame .bat-3 .level:nth-child(6) {
          width: calc(100% + 12%);
          rotate: calc(-14deg + 12deg);
        }
        .frame .bat-3 .level:nth-child(6) .window {
          transform: skew(calc(-14deg + 6deg));
        }
        .frame .bat-3 .level:nth-child(7) {
          width: calc(100% + 14%);
          rotate: calc(-14deg + 14deg);
        }
        .frame .bat-3 .level:nth-child(7) .window {
          transform: skew(calc(-14deg + 7deg));
        }
        .frame .bat-3 .level:nth-child(8) {
          width: calc(100% + 16%);
          rotate: calc(-14deg + 16deg);
        }
        .frame .bat-3 .level:nth-child(8) .window {
          transform: skew(calc(-14deg + 8deg));
        }
        .frame .bat-3 .level:nth-child(9) {
          width: calc(100% + 18%);
          rotate: calc(-14deg + 18deg);
        }
        .frame .bat-3 .level:nth-child(9) .window {
          transform: skew(calc(-14deg + 9deg));
        }
        .frame .bat-3 .level:nth-child(10) {
          width: calc(100% + 20%);
          rotate: calc(-14deg + 20deg);
        }
        .frame .bat-3 .level:nth-child(10) .window {
          transform: skew(calc(-14deg + 10deg));
        }
        .frame .bat-3 .level:nth-child(11) {
          width: calc(100% + 22%);
          rotate: calc(-14deg + 22deg);
        }
        .frame .bat-3 .level:nth-child(11) .window {
          transform: skew(calc(-14deg + 11deg));
        }
        .frame .bat-3 .level:nth-child(12) {
          width: calc(100% + 24%);
          rotate: calc(-14deg + 24deg);
        }
        .frame .bat-3 .level:nth-child(12) .window {
          transform: skew(calc(-14deg + 12deg));
        }
        .frame .bat-3 .level:nth-child(13) {
          width: calc(100% + 26%);
          rotate: calc(-14deg + 26deg);
        }
        .frame .bat-3 .level:nth-child(13) .window {
          transform: skew(calc(-14deg + 13deg));
        }
        .frame .bat-3 .level:nth-child(14) {
          width: calc(100% + 28%);
          rotate: calc(-14deg + 28deg);
        }
        .frame .bat-3 .level:nth-child(14) .window {
          transform: skew(calc(-14deg + 14deg));
        }
        .frame .bat-4 {
          rotate: 4deg;
          position: absolute;
          right: 26%;
          bottom: -10%;
          width: 40%;
          height: 65%;
          background: linear-gradient(to bottom, #4A474D, #4A4049);
          clip-path: polygon(0 13%, 69% 0%, 100% 100%, 0% 100%);
          filter: blur(1.5px);
          padding-top: 10%;
          padding-right: 25%;
          box-sizing: border-box;
        }
        .frame .bat-4 .level {
          rotate: -16deg;
          margin-bottom: 27%;
        }
        .frame .bat-4 .level .window {
          width: 10%;
          background: #20181544;
          transform: skew(-10deg);
        }
        .frame .bat-4 .level:nth-child(2) {
          width: calc(100% + 3.4%);
          rotate: calc(-14deg + 3.4deg);
        }
        .frame .bat-4 .level:nth-child(2) .window {
          transform: skew(calc(-14deg + 2deg));
        }
        .frame .bat-4 .level:nth-child(3) {
          width: calc(100% + 5.1%);
          rotate: calc(-14deg + 5.1deg);
        }
        .frame .bat-4 .level:nth-child(3) .window {
          transform: skew(calc(-14deg + 3deg));
        }
        .frame .bat-4 .level:nth-child(4) {
          width: calc(100% + 6.8%);
          rotate: calc(-14deg + 6.8deg);
        }
        .frame .bat-4 .level:nth-child(4) .window {
          transform: skew(calc(-14deg + 4deg));
        }
        .frame .bat-4 .level:nth-child(5) {
          width: calc(100% + 8.5%);
          rotate: calc(-14deg + 8.5deg);
        }
        .frame .bat-4 .level:nth-child(5) .window {
          transform: skew(calc(-14deg + 5deg));
        }
        .frame .bat-4 .level:nth-child(6) {
          width: calc(100% + 10.2%);
          rotate: calc(-14deg + 10.2deg);
        }
        .frame .bat-4 .level:nth-child(6) .window {
          transform: skew(calc(-14deg + 6deg));
        }
        .frame .bat-4 .level:nth-child(7) {
          width: calc(100% + 11.9%);
          rotate: calc(-14deg + 11.9deg);
        }
        .frame .bat-4 .level:nth-child(7) .window {
          transform: skew(calc(-14deg + 7deg));
        }
        .frame .bat-4 .level:nth-child(8) {
          width: calc(100% + 13.6%);
          rotate: calc(-14deg + 13.6deg);
        }
        .frame .bat-4 .level:nth-child(8) .window {
          transform: skew(calc(-14deg + 8deg));
        }
        .frame .bat-4 .level:nth-child(9) {
          width: calc(100% + 15.3%);
          rotate: calc(-14deg + 15.3deg);
        }
        .frame .bat-4 .level:nth-child(9) .window {
          transform: skew(calc(-14deg + 9deg));
        }
        .frame .bat-4 .level:nth-child(10) {
          width: calc(100% + 17%);
          rotate: calc(-14deg + 17deg);
        }
        .frame .bat-4 .level:nth-child(10) .window {
          transform: skew(calc(-14deg + 10deg));
        }
        .frame .bat-4 .level:nth-child(11) {
          width: calc(100% + 18.7%);
          rotate: calc(-14deg + 18.7deg);
        }
        .frame .bat-4 .level:nth-child(11) .window {
          transform: skew(calc(-14deg + 11deg));
        }
        .frame .bat-4 .level:nth-child(12) {
          width: calc(100% + 20.4%);
          rotate: calc(-14deg + 20.4deg);
        }
        .frame .bat-4 .level:nth-child(12) .window {
          transform: skew(calc(-14deg + 12deg));
        }
        .frame .bat-4 .level:nth-child(13) {
          width: calc(100% + 22.1%);
          rotate: calc(-14deg + 22.1deg);
        }
        .frame .bat-4 .level:nth-child(13) .window {
          transform: skew(calc(-14deg + 13deg));
        }
        .frame .bat-4 .level:nth-child(14) {
          width: calc(100% + 23.8%);
          rotate: calc(-14deg + 23.8deg);
        }
        .frame .bat-4 .level:nth-child(14) .window {
          transform: skew(calc(-14deg + 14deg));
        }
        .frame .pole {
          rotate: 14deg;
          position: absolute;
          right: 68%;
          bottom: -10%;
          width: 10%;
          height: 68%;
          clip-path: polygon(0 0, 21% 0, 100% 100%, 0% 100%);
          background: linear-gradient(31deg, #29180E, #29180E, #614121 90%, #614121);
        }
        .frame .lamp {
          rotate: -90deg;
          position: absolute;
          right: 45%;
          top: 37.5%;
          border-radius: 40% 50% 50% 40%;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0