css实现下雪动画背景效果代码

代码语言:html

所属分类:粒子

代码描述:css实现下雪动画背景效果代码

代码标签: 动画 背景 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
html, body {
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(#123, #111);
}

.snowflake {
  --size: 1vw;
  width: var(--size);
  height: var(--size);
  background: white;
  border-radius: 50%;
  position: absolute;
  top: -5vh;
}

@keyframes snowfall {
  0% {
    transform: translate3d(var(--left-ini), 0, 0);
  }
  100% {
    transform: translate3d(var(--left-end), 110vh, 0);
  }
}
.snowflake:nth-child(1) {
  --size: 0.6vw;
  --left-ini: -5vw;
  --left-end: 6vw;
  left: 11vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -1s;
}

.snowflake:nth-child(2) {
  --size: 0.6vw;
  --left-ini: 0vw;
  --left-end: 7vw;
  left: 14vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -6s;
}

.snowflake:nth-child(3) {
  --size: 1vw;
  --left-ini: -2vw;
  --left-end: 0vw;
  left: 11vw;
  animation: snowfall 9s linear infinite;
  animation-delay: -3s;
}

.snowflake:nth-child(4) {
  --size: 0.8vw;
  --left-ini: -5vw;
  --left-end: 5vw;
  left: 92vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -8s;
}

.snowflake:nth-child(5) {
  --size: 0.8vw;
  --left-ini: -7vw;
  --left-end: 7vw;
  left: 98vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -9s;
}

.snowflake:nth-child(6) {
  --size: 0.4vw;
  --left-ini: 3vw;
  --left-end: -5vw;
  left: 30vw;
  animation: snowfall 9s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(7) {
  --size: 0.4vw;
  --left-ini: 3vw;
  --left-end: -5vw;
  left: 99vw;
  animation: snowfall 7s linear infinite;
  animation-delay: -10s;
}

.snowflake:nth-child(8) {
  --size: 0.2vw;
  --left-ini: 6vw;
  --left-end: -9vw;
  left: 34vw;
  animation: snowfall 12s linear infinite;
  animation-delay: -4s;
}

.snowflake:nth-child(9) {
  --size: 0.4vw;
  --left-ini: 10vw;
  --left-end: 5vw;
  left: 49vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -6s;
}

.snowflake:nth-child(10) {
  --size: 0.6vw;
  --left-ini: 6vw;
  --left-end: 7vw;
  left: 85vw;
  animation: snowfall 12s linear infinite;
  animation-delay: -9s;
}

.snowflake:nth-child(11) {
  --size: 1vw;
  --left-ini: 6vw;
  --left-end: -2vw;
  left: 28vw;
  animation: snowfall 8s linear infinite;
  animation-delay: -8s;
}

.snowflake:nth-child(12) {
  --size: 0.8vw;
  --left-ini: -8vw;
  --left-end: -8vw;
  left: 51vw;
  animation: snowfall 7s linear infinite;
  animation-delay: -3s;
}

.snowflake:nth-child(13) {
  --size: 0.8vw;
  --left-ini: 10vw;
  --left-end: 3vw;
  left: 31vw;
  animation: snowfall 8s linear infinite;
  animation-delay: -7s;
}

.snowflake:nth-child(14) {
  --size: 1vw;
  --left-ini: -9vw;
  --left-end: -4vw;
  left: 99vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -8s;
}

.snowflake:nth-child(15) {
  --size: 0.4vw;
  --left-ini: -6vw;
  --left-end: 8vw;
  left: 5vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(16) {
  --size: 0.6vw;
  --left-ini: 8vw;
  --left-end: 6vw;
  left: 78vw;
  animation: snowfall 14s linear infinite;
  animation-delay: -6s;
}

.snowflake:nth-child(17) {
  --size: 0.4vw;
  --left-ini: 2vw;
  --left-end: -7vw;
  left: 15vw;
  animation: snowfall 14s linear infinite;
  animation-delay: -5s;
}

.snowflake:nth-child(18) {
  --size: 0.8vw;
  --left-ini: 3vw;
  --left-end: -5vw;
  left: 95vw;
  animation: snowfall 11s linear infinite;
  animation-delay: -7s;
}

.snowflake:nth-child(19) {
  --size: 0.4vw;
  --left-ini: -9vw;
  --left-end: 2vw;
  left: 38vw;
  animation: snowfall 11s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(20) {
  --size: 0.4vw;
  --left-ini: 5vw;
  --left-end: 6vw;
  left: 31vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -10s;
}

.snowflake:nth-child(21) {
  --size: 1vw;
  --left-ini: -9vw;
  --left-end: -8vw;
  left: 22vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -8s;
}

.snowflake:nth-child(22) {
  --size: 0.6vw;
  --left-ini: 3vw;
  --left-end: -1vw;
  left: 47vw;
  animation: snowfall 9s linear infinite;
  animation-delay: -4s;
}

.snowflake:nth-child(23) {
  --size: 0.8vw;
  --left-ini: 3vw;
  --left-end: -2vw;
  left: 4vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -8s;
}

.snowflake:nth-child(24) {
  --size: 0.8vw;
  --left-ini: 2vw;
  --left-end: 6vw;
  left: 31vw;
  animation: snowfall 14s linear infinite;
  animation-delay: -5s;
}

.snowflake:nth-child(25) {
  --size: 0.2vw;
  --left-ini: -7vw;
  --left-end: 5vw;
  left: 39vw;
  animation: snowfall 14s linear infinite;
  animation-delay: -6s;
}

.snowflake:nth-child(26) {
  --size: 0.8vw;
  --left-ini: -8vw;
  --left-end: 10vw;
  left: 43vw;
  animation: snowfall 15s linear infinite;
  animation-delay: -10s;
}

.snowflake:nth-child(27) {
  --size: 0.2vw;
  --left-ini: 6vw;
  --left-end: -9vw;
  left: 68vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -6s;
}

.snowflake:nth-child(28) {
  --size: 0.2vw;
  --left-ini: 3vw;
  --left-end: 6vw;
  left: 97vw;
  animation: snowfall 6s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(29) {
  --size: 0.2vw;
  --left-ini: -8vw;
  --left-end: -9vw;
  left: 81vw;
  animation: snowfall 8s linear infinite;
  animation-delay: -4s;
}

.snowflake:nth-child(30) {
  --size: 0.4vw;
  --left-ini: 10vw;
  --left-end: -1vw;
  left: 95vw;
  animation: snowfall 11s linear infinite;
  animation-delay: -10s;
}

.snowflake:nth-child(31) {
  --size: 0.2vw;
  --left-ini: 7vw;
  --left-end: 7vw;
  left: 39vw;
  animation: snowfall 11s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(32) {
  --size: 1vw;
  --left-ini: 9vw;
  --left-end: -2vw;
  left: 12vw;
  animation: snowfall 7s linear infinite;
  animation-delay: -2s;
}

.snowflake:nth-child(33) {
  --size: 0.6vw;
  --left-ini: 8vw;
  --left-end: 4vw;
  left: 17vw;
  animation: snowfall 11s linear infinite;
  animation-delay: -3s;
}

.snowflake:nth-child(34) {
  --size: 0.4vw;
  --left-ini: 5vw;
  --left-end: 3vw;
  left: 68vw;
  animation: snowfall 15.........完整代码请登录后点击上方下载按钮下载查看

网友评论0