jquery实现粒子上升飘动动画效果

代码语言:html

所属分类:粒子

代码描述:jquery实现粒子上升飘动动画效果

代码标签: 上升 飘动 动画 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
@import url("https://fonts.googleapis.com/css?family=Montserrat:200,300,400,600");
.more-pens {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 10;
  font-family: "Montserrat";
  font-size: 12px;
}

a.white-mode, a.white-mode:link, a.white-mode:visited, a.white-mode:active {
  font-family: "Montserrat";
  font-size: 12px;
  text-decoration: none;
  background: #212121;
  padding: 4px 8px;
  color: #f7f7f7;
}
a.white-mode:hover, a.white-mode:link:hover, a.white-mode:visited:hover, a.white-mode:active:hover {
  background: #edf3f8;
  color: #212121;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.background {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: #edf3f8;
  background: -moz-radial-gradient(center, ellipse cover, #edf3f8 1%, #dee3e8 100%);
  background: -webkit-radial-gradient(center, ellipse cover, #edf3f8 1%, #dee3e8 100%);
  background: radial-gradient(ellipse at center, #edf3f8 1%, #dee3e8 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf3f8', endColorstr='#dee3e8',GradientType=1 );
}

.title {
  z-index: 10;
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%) translateY(-50%);
  font-family: "Montserrat";
  text-align: center;
  width: 60%;
}
.title h1 {
  position: relative;
  color: #000000;
  font-weight: 300;
  font-size: 46px;
  padding: 0;
  margin: 0;
  line-height: 1;
}
.title h2 {
  font-weight: 600;
  font-size: 60px;
  padding: 0;
  margin: 0;
  line-height: 1;
}
.title h3 {
  font-weight: 200;
  font-size: 20px;
  padding: 0;
  margin: 0;
  line-height: 2;
  color: #5e7283;
  letter-spacing: 2px;
}
.title p {
  font-weight: 200;
  font-size: 16px;
  color: #5e7283;
}

.pentahedron {
  position: absolute;
  width: 100%;
  height: 100%;
  fill: #3E82F7;
}

.point {
  fill: #8491A3;
}

.rhombus {
  fill: #2DA94F;
  stroke: #2DA94F;
}

.x {
  fill: #FDBD00;
}

.circle {
  fill: #ED412D;
}

svg {
  display: block;
  width: 30px;
  height: 30px;
  position: absolute;
  transform: translateZ(0px);
}
</style>

</head>
<body translate="no">
<div class="more-pens">
<a target="_blank" href="" class="white-mode">
WATCH THE BALLOONS PARTICLES</a> or
<a target="_blank" href="" class="white-mode">VIEW OTHER PENS</a>
</div>
<div class="background"></div>
<div class="title">
<h3>PLASM.it - 2017</h3>
<h1>Antigravity</h1>
<h2>FLOW</h2>
</div>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
<script>
class Particle {

  constructor(svg, coordinates, friction) {
    this.svg = svg;
    this.steps = $(window).height() / 2;
    this.item = null;
    this.friction = friction;
    this.coordinates = coordinates;
    this.position = this.coordinates.y;
    this.dimensions = this.render();
    this.rotation = Math.random() > 0.5 ? "-" : "+";
    this.scale = 0.5 + Math.random();
    this.siner = 200 * Math.random();
  }

  destroy() {
    this.item.remove();
  }

  move() {
    this.positio.........完整代码请登录后点击上方下载按钮下载查看

网友评论0