css实现窗外冬季雪花飞舞动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现窗外冬季雪花飞舞动画效果代码

代码标签: 冬季 雪花 飞舞 动画 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
<style>
* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #35a66f;
  text-align: center;
}

#christmas {
  background: #162a4e;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzBjMWQzOCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzFhMzE1OCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
  background-size: 100%;
  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0c1d38), color-stop(100%, #1a3158));
  background-image: -moz-linear-gradient(#0c1d38, #1a3158);
  background-image: -webkit-linear-gradient(#0c1d38, #1a3158);
  background-image: linear-gradient(#0c1d38, #1a3158);
  position: relative;
  width: 182px;
  height: 182px;
  margin: 50px auto;
  overflow: hidden;
  /* iOS hack for border radius bleed with transforms */
  -webkit-mask-image: -webkit-radial-gradient(circle, white, black);
}
#christmas .ground {
  -moz-border-radius-topright: 130px 40px;
  -webkit-border-top-right-radius: 130px 40px;
  border-top-right-radius: 130px 40px;
  position: absolute;
  width: 133px;
  height: 61px;
  left: 0;
  bottom: 0;
  background: white;
}
#christmas .ground:before {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  content: " ";
  position: absolute;
  width: 130px;
  height: 100px;
  top: 10px;
  right: -60px;
  background: white;
}
#christmas .ground:after {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  content: " ";
  position: absolute;
  width: 70px;
  height: 70px;
  top: 5px;
  right: -75px;
  background: white;
}
#christmas .tree {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent transparent #23915b transparent;
}
#christmas .tree:before {
  content: " ";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent transparent #23915b transparent;
}
#christmas .tree:after {
  content: " ";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent transparent #23915b transparent;
}
#christmas .tree.left {
  left: 28px;
  bottom: 78px;
  border-width: 0 18px 24px 18px;
}
#christmas .tree.left:before {
  top: 10px;
  left: -21px;
  border-width: 0 21px 28px 21px;
}
#christmas .tree.left:after {
  top: 22px;
  left: -24px;
  border-width: 0 24px 32px 24px;
}
#christmas .tree.left .snow {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-box-shadow: -2px 2px 0 0 white, 2px 2px 0 0 white, -3px 3px 0 0 white, 3px 3px 0 0 white, -12px 14px 0 0 white, -13px 17px 0 1px white, -16px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 11px 14px 0 1px white, 13px 17px 0 1px white, 15px 19px 0 0 white;
  -webkit-box-shadow: -2px 2px 0 0 white, 2px 2px 0 0 white, -3px 3px 0 0 white, 3px 3px 0 0 white, -12px 14px 0 0 white, -13px 17px 0 1px white, -16px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 11px 14px 0 1px white, 13px 17px 0 1px white, 15px 19px 0 0 white;
  box-shadow: -2px 2px 0 0 white, 2px 2px 0 0 white, -3px 3px 0 0 white, 3px 3px 0 0 white, -12px 14px 0 0 white, -13px 17px 0 1px white, -16px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 11px 14px 0 1px white, 13px 17px 0 1px white, 15px 19px 0 0 white;
  position: absolute;
  top: 1px;
  left: -3px;
  width: 6px;
  height: 6px;
  background: white;
  z-index: 1;
}
#christmas .tree.left .snow:after {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-box-shadow: -14px 14px 0 0 white, -15px 17px 0 1px white, -18px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 12px 17px 0 3px white, 16px 17px 0 1px white, 18px 19px 0 0 white, 11px 20px 0 1px white, 16px 20px 0 1px white, 18px 22px 0 1px white, 21px 25px 0 0 white, -2px 27px 0 1px white;
  -webkit-box-shadow: -14px 14px 0 0 white, -15px 17px 0 1px white, -18px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 12px 17px 0 3px white, 16px 17px 0 1px white, 18px 19px 0 0 white, 11px 20px 0 1px white, 16px 20px 0 1px white, 18px 22px 0 1px white, 21px 25px 0 0 white, -2px 27px 0 1px white;
  box-shadow: -14px 14px 0 0 white, -15px 17px 0 1px white, -18px 19px 0 0 white, -9px 16px 0 0 white, -5px 15px 0 2px white, -9px 13px 0 0 white, 6px 15px 0 2px white, 0 13px 0 1px white, 12px 17px 0 3px white, 16px 17px 0 1px white, 18px 19px 0 0 white, 11px 20px 0 1px white, 16px 20px 0 1px white, 18px 22px 0 1px white, 21px 25px 0 0 white, -2px 27px 0 1px white;
  content: " ";
  position: absolute;
  top: 14px;
  left: 0px;
  width: 6px;
  height: 6px;
  background: white;
  z-index: 1;
}
#christmas .tree.right {
  left: 60px;
  bottom: 45px;
  border-width: 0 18px 24px 18px;
}
#christmas .tree.right:before, #christmas .tree.right:after {
  display: none;
}
#christmas .tree.right .snow {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  -moz-box-shadow: -1px 2px 0 0 white, -2px 3px 0 0 white, 2px 2px 0 0 white, 3px 3px 0 0 white, 4px 4px 0 0 white, 6px 6px 0 0 white, 6px 15px 0 0 white, 8px 16px 0 0 white, 10px 16px 0 0 white, 11px 16px 0 0 white, -5px 13px 0 0 white, -7px 12px 0 0 white;
  -webkit-box-shadow: -1px 2px 0 0 white, -2px 3px 0 0 white, 2px 2px 0 0 white, 3px 3px 0 0 white, 4px 4px 0 0 white, 6px 6px 0 0 white, 6px 15px 0 0 white, 8px 16px 0 0 white, 10px 16px 0 0 white, 11px 16px 0 0 white, -5px 13px 0 0 white, -7px 12px 0 0 white;
  box-shadow: -1px 2px 0 0 white, -2px 3px 0 0 white, 2px 2px 0 0 white, 3px 3px 0 0 white, 4px 4px 0 0 white, 6px 6px 0 0 white, 6px 15px 0 0 white, 8px 16px 0 0 white, 10px 16px 0 0 white, 11px 16px 0 0 white, -5px 13px 0 0 white, -7px 12px 0 0 white;
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 6px;
  background: white;
}
#christmas .flake {
  -webkit-animation: snow infinite linear 30s;
  -moz-animation: snow infinite linear 30s;
  -ms-animation: snow infinite linear 30s;
  -o-animation: snow infinite linear 30s;
  animation: snow infinite linear 30s;
  position: absolute;
  width: 1px;
  height: 1px;
  background: white;
}
#christmas .flake.large {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  width: 4px;
  height: 4px;
}
#christmas .flake.f-1 {
  -webkit-animation-duration: 20s;
  -moz-animation-duration: 20s;
  -ms-animation-duration: 20s;
  -o-animation-duration: 20s;
  animation-duration: 20s;
  left: 15px;
  margin-top: 86px;
}
#christmas .flake.f-2 {
  -webkit-animation-duration: 23s;
  -moz-animation-duration: 23s;
  -ms-animation-duration: 23s;
  -o-animation-duration: 23s;
  animation-duration: 23s;
  left: 32px;
  margin-top: 52px;
}
#christmas .flake.f-3 {
  -webkit-animation-duration: 32s;
  -moz-animation-duration: 32s;
  -ms-animation-duration: 32s;
  -o-animation-duration: 32s;
  animation-duration: 32s;
  left: 64px;
  margin-top: 15px;
}
#christmas .flake.f-4 {
  -webkit-animation-duration: 21s;
  -moz-animation-duration: 21s;
  -ms-animation-duration: 21s;
  -o-animation-duration: 21s;
  animation-duration: 21s;
  left: 69px;
  margin-top: 34px;
}
#christmas .flake.f-5 {
  -webkit-animation-duration: 24s;
  -moz-animation-duration: 24s;
  -ms-animation-duration: 24s;
  -o-animation-duration: 24s;
  animation-duration: 24s;
  left: 70px;
  margin-top: 72px;
}
#christmas .flake.f-6 {
  -webkit-animation-duration: 16s;
  -moz-animation-duration: 16s;
  -ms-animation-duration: 16s;
  -o-animation-duration: 16s;
  animation-duration: 16s;
  left: 90px;
  margin-top: 97px;
}
#christmas .flake.f-7 {
  -webkit-animation-duration: 34s;
  -moz-animation-duration: 34s;
  -ms-animation-duration: 34s;
  -o-animation-duration: 34s;
  animation-duration: 34s;
  left: 102px;
  margin-top: 81px;
}
#christmas .flake.f-8 {
  -webkit-animation-duration: 37s;
  -moz-animation-d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0