css模拟森林的各种天气和季节变换效果代码

代码语言:html

所属分类:动画

代码描述:css模拟森林的各种天气和季节变换效果代码

代码标签: 各种 气和 季节 变换 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
  
<style>
:root {
  --bgd-color: #cbe9f4;
  --light: #93d5eb;
  --medium: #66bbd8;
  --dark: #4da2bb;
  --bush: #ffffff;
  --trunk: #c2653c;
  --trunk2: #9d5d5d;
  --cloud: #ffffff;
  --sun: transparent;
  --rabbit: #ffffff;
}

*,
*:before,
*:after {
  -webkit-transition: 4s ease background;
  transition: 4s ease background;
  position: absolute;
}

body {
  padding: 0;
  margin: 0;
  overflow: hidden;
  background-color: var(--bgd-color);
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  height: 100vh;
  width: 100vw;
}

.container {
  position: relative;
  width: 800px;
  height: 450px;
}

.sun {
  background-color: var(--sun);
  width: 60px;
  height: 60px;
  border-radius: 100%;
  top: -20px;
  left: 180px;
}

.rainbow {
  visibility: hidden;
  width: 600px;
  height: 270px;
  left: 100px;
  bottom: 82px;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}
.rainbow.animated {
  -webkit-animation: rainbow 14s linear;
          animation: rainbow 14s linear;
  visibility: visible;
}
.rainbow .rainbow-colour {
  border-top-left-radius: 50% 100%;
  border-top-right-radius: 50% 100%;
  border-bottom: 0;
  left: 50%;
  -webkit-transform: translate(-50%, 0);
          transform: translate(-50%, 0);
  -webkit-transform-origin: 0 100%;
          transform-origin: 0 100%;
  bottom: 0;
  border-bottom: 0 !important;
}
.rainbow .rainbow-colour:nth-child(1) {
  border: 10px solid #ac01fd;
  height: 100%;
  width: 100%;
}
.rainbow .rainbow-colour:nth-child(2) {
  border: 10px solid #511ce0;
  height: 261px;
  width: 581px;
}
.rainbow .rainbow-colour:nth-child(3) {
  border: 10px solid #1a9fe2;
  height: 252px;
  width: 562px;
}
.rainbow .rainbow-colour:nth-child(4) {
  border: 10px solid #5ed81d;
  height: 243px;
  width: 543px;
}
.rainbow .rainbow-colour:nth-child(5) {
  border: 10px solid #f8f52a;
  height: 234px;
  width: 524px;
}
.rainbow .rainbow-colour:nth-child(6) {
  border: 10px solid #f7a528;
  height: 225px;
  width: 505px;
}
.rainbow .rainbow-colour:nth-child(7) {
  border: 10px solid #f63b2a;
  height: 216px;
  width: 486px;
}

@-webkit-keyframes rainbow {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
  }
}

@keyframes rainbow {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
  }
}
.cloud-group {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
}

.cloud {
  background-color: var(--cloud);
  width: 80px;
  height: 30px;
  border-radius: 50px;
  left: 50px;
  top: 40px;
  -webkit-animation: clouds 10s linear infinite;
          animation: clouds 10s linear infinite;
}

@-webkit-keyframes clouds {
  50% {
    -webkit-transform: translateX(20px);
            transform: translateX(20px);
  }
  100% {
    -webkit-transform: translateX(0);
            transform: translateX(0);
  }
}

@keyframes clouds {
  50% {
    -webkit-transform: translateX(20px);
            transform: translateX(20px);
  }
  100% {
    -webkit-transform: translateX(0);
            transform: translateX(0);
  }
}
.weather-container {
  width: 100%;
  height: 400px;
}

.snow {
  opacity: 0;
  background-color: #ffffff;
  width: 6px;
  height: 6px;
  border-radius: 100%;
  -webkit-transition: 2s ease all;
  transition: 2s ease all;
  -webkit-animation: snow 5s linear infinite;
          animation: snow 5s linear infinite;
}

.snow:nth-of-type(1) {
  top: 11px;
  left: 34px;
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}

.snow:nth-of-type(2) {
  top: 20px;
  left: 65px;
  -webkit-animation-delay: 4s;
          animation-delay: 4s;
}

.snow:nth-of-type(3) {
  top: 18px;
  left: 18px;
  -webkit-animation-delay: 6s;
          animation-delay: 6s;
}

.snow:nth-of-type(4) {
  top: 8px;
  left: 70px;
  -webkit-animation-delay: 3s;
          animation-delay: 3s;
}

.snow:nth-of-type(5) {
  top: 4px;
  left: 19px;
  -webkit-animation-delay: 4s;
          animation-delay: 4s;
}

.snow:nth-of-type(6) {
  top: 25px;
  left: 26px;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.snow:nth-of-type(7) {
  top: 24px;
  left: 66px;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.snow:nth-of-type(8) {
  top: 3px;
  left: 29px;
  -webkit-animation-delay: 10s;
          animation-delay: 10s;
}

.snow:nth-of-type(9) {
  top: 21px;
  left: 5px;
  -webkit-animation-delay: 6s;
          animation-delay: 6s;
}

.snow:nth-of-type(10) {
  top: 26px;
  left: 19px;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.snow:nth-of-type(11) {
  top: 4px;
  left: 2px;
  -webkit-animation-delay: 5s;
          animation-delay: 5s;
}

.snow:nth-of-type(12) {
  top: 9px;
  left: 18px;
  -webkit-animation-delay: 6s;
          animation-delay: 6s;
}

.snow:nth-of-type(13) {
  top: 12px;
  left: 37px;
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}

.snow:nth-of-type(14) {
  top: 10px;
  left: 65px;
  -webkit-animation-delay: 3s;
          animation-delay: 3s;
}

.snow:nth-of-type(15) {
  top: 13px;
  left: 32px;
  -webkit-animation-delay: 8s;
          animation-delay: 8s;
}

.snow:nth-of-type(16) {
  top: 2px;
  left: 51px;
  -webkit-animation-delay: 4s;
          animation-delay: 4s;
}

.snow:nth-of-type(17) {
  top: 30px;
  left: 36px;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.snow:nth-of-type(18) {
  top: 13px;
  left: 46px;
  -webkit-animation-delay: 8s;
          animation-delay: 8s;
}

.snow:nth-of-type(19) {
  top: 4px;
  left: 68px;
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}

.snow:nth-of-type(20) {
  top: 8px;
  left: 63px;
  -webkit-animation-delay: 7s;
          animation-delay: 7s;
}

.rain {
  opacity: 0;
  display: none;
  background-color: #eaf9fe;
  width: 4px;
  height: 8px;
  -webkit-transform: rotate(-30deg);
          transform: rotate(-30deg);
  border-color: #eaf9fe;
  border-top-left-radius: 50%;
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
  -webkit-transition: 2s ease all;
  transition: 2s ease all;
  -webkit-animation: drops 1s linear infinite;
          animation: drops 1s linear infinite;
}

.rain:nth-child(1) {
  top: 7px;
  left: 22px;
  -webkit-animation-delay: 0.1s;
          animation-delay: 0.1s;
}

.rain:nth-child(2) {
  top: 6px;
  left: 7px;
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s;
}

.rain:nth-child(3) {
  top: 13px;
  left: 59px;
  -webkit-animation-delay: 0.3s;
          animation-delay: 0.3s;
}

.rain:nth-child(4) {
  top: 14px;
  left: 9px;
  -webkit-animation-delay: 0.4s;
          animation-delay: 0.4s;
}

.rain:nth-child(5) {
  top: 17px;
  left: 56px;
  -webkit-animation-delay: 0.5s;
          animation-delay: 0.5s;
}

.rain:nth-child(6) {
  top: 9px;
  left: 48px;
  -webkit-animation-delay: 0.6s;
          animation-delay: 0.6s;
}

.rain:nth-child(7) {
  top: 25px;
  left: 7px;
  -webkit-animation-delay: 0.7s;
          animation-delay: 0.7s;
}

.rain:nth-child(8) {
  top: 24px;
  left: 22px;
  -webkit-animation-delay: 0.8s;
          animation-delay: 0.8s;
}

.rain:nth-child(9) {
  top: 14px;
  left: 22px;
  -webkit-animation-delay: 0.9s;
          animation-delay: 0.9s;
}

.rain:nth-child(10) {
  top: 22px;
  left: 27px;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.rain:nth-child(11) {
  top: 8px;
  left: 17px;
  -webkit-animation-delay: 1.1s;
          animation-delay: 1.1s;
}

.rain:nth-child(12) {
  top: 20px;
  left: 15px;
  -webkit-animation-delay: 1.2s;
          animation-delay: 1.2s;
}

.rain:nth-child(13) {
  top: 14px;
  left: 31px;
  -webkit-animation-delay: 1.3s;
          animation-delay: 1.3s;
}

.rain:nth-child(14) {
  top: 13px;
  left: 58px;
  -webkit-animation-delay: 1.4s;
          animation-delay: 1.4s;
}

.rain:nth-child(15) {
  top: 14px;
  left: 30px;
  -webkit-animation-delay: 1.5s;
          animation-delay: 1.5s;
}

.rain:nth-child(16) {
  top: 27px;
  left: 58px;
  -webkit-animation-delay: 1.6s;
          animation-delay: 1.6s;
}

.rain:nth-child(17) {
  top: 17px;
  left: 57px;
  -webkit-animation-delay: 1.7s;
          animation-delay: 1.7s;
}

.rain:nth-child(18) {
  top: 2px;
  left: 45px;
  -webkit-animation-delay.........完整代码请登录后点击上方下载按钮下载查看

网友评论0