tsparticles实现图形路径粒子效果

代码语言:html

所属分类:粒子

代码描述:tsparticles实现图形路径粒子效果

代码标签: 路径 粒子 效果

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/bootstrap.4.3.1.min.css">
<style>
/* ---- reset ---- */
body {
  margin: 0;
  font: normal 75% Arial, Helvetica, sans-serif;
}

canvas {
  display: block;
  vertical-align: bottom;
}
/* ---- tsparticles container ---- */
#tsparticles {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #1d428a;
}

.github {
  bottom: 10px;
  right: 10px;
  position: fixed;
  border-radius: 10px;
  background: #fff;
  padding: 0 12px 6px 12px;
  border: 1px solid #000;
}

.github a:hover,
.github a:link,
.github a:visited,
.github a:active {
  color: #000;
  text-decoration: none;
}

.github img {
  height: 30px;
}

.github #gh-project {
  font-size: 20px;
  padding-left: 5px;
  font-weight: bold;
  vertical-align: bottom;
}
</style>

</head>
<body translate="no">


<div id="tsparticles"></div>

<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/pathseg.min.js"></script>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/tsparticles-1.16.0.js"></script>


<script>
tsParticles.load("tsparticles", {
  detectRetina: false,
  fpsLimit: 60,
  interactivity: {
    detectsOn: "canvas",
    events: {
      onHover: {
        enable: true,
        mode: "bubble"
      },
      resize: true
    },
    modes: {
      bubble: {
        color: "#fdb927",
        distance: 100,
        duration: 2,
        opacity: 1,
        size: 10,
        speed: 3
      }
    }
  },
  particles: {
    color: {
      value: "#fff"
    },
    links: {
      blink: false,
      color: "#fff",
      consent: false,
      distance: 20,
      enable: true,
      opacity: 0.8,
      width: 1
    },
    move: {
      attract: {
        enable: false,
        rotate: {
          x: 600,
          y: 1200
        }
      },
      bounce: false,
      direction: "none",
      enable: true,
      outMode: "bounce",
      random: false,
      speed: 1,
      straight: false
    },
    number: {
      density: {
        enable: false,
        area: 2000
      },
      limit: 0,
      value: 300
    },
    opacity: {
      animation: {
        enable: true,
        minimumValue: 0.05,
        speed: 3,
        sync: false
      },
      random: false,
      value: 1
    },
    shape: {
      type: "circle"
    },
    size: {
      animation: {
        enable: false,
        minimumValue: 0.1,
        speed: 40,
        sync: false
      },
      random: true,
      value: 3
    }
  },
  polygon: {
    draw: {
      enable: true,
      lineColor: "#fdb927",
      lineWidth: 1
    },
    move: {
      radius: 10
    },
    inlineArrangement: "equidistant",
    scale: 0.5,
    type: "inline",
    data: {
      path:
        "M 805.15389,268.24464 A 443.37188,443.37188 0 1 0 178.13136,895.26708 443.37188,443.37188 0 1 0 805.15389,268.24464 m -610.04763,16.9749 a 419.56486,419.56486 0 0 1 679.20443,468.59032 c -50.92459,-17.18457 -101.011,-36.46451 -150.04951,-58.25939 -6.49639,-2.93394 -12.99313,-5.65834 -19.28011,-8.59228 l -19.07057,-9.01133 -9.64023,-4.61049 -9.43046,-4.61048 -18.86098,-9.43051 c -6.28702,-3.14349 -12.574,-6.49639 -18.65139,-9.8496 l -9.43051,-5.02962 c -3.14349,-1.67649 -6.07739,-3.35308 -9.22088,-5.02957 l -18.44184,-10.26874 -18.23252,-10.687.........完整代码请登录后点击上方下载按钮下载查看

网友评论0