<!-- tsParticles container -->
<div id="tsparticles"></div>
<!-- https://github.com/matteobruni/tsparticles -->
<div class="github">
<a class="btn btn-link" href="https://github.com/matteobruni/tsparticles" title="Find more info on GitHub">
<img class="img-fluid" id="gh-mark" src="https://cdn.matteobruni.it/images/particles/GitHub-Mark-120px-plus.png" alt="">
<span id="gh-project">Made with tsParticles</span>
</a>
<div>
<a class="github-button" href="https://github.com/matteobruni/tsparticles" data-icon="octicon-star" data-show-count="true" aria-label="Star matteobruni/tsparticles on GitHub">Star</a>
<a class="github-button" href="https://github.com/matteobruni/tsparticles/fork" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork matteobruni/tsparticles on GitHub">Fork</a>
<a class="github-button" href="https://github.com/matteobruni/tsparticles/releases/tag/tsparticles%401.17.9" data-icon="octicon-download" aria-label="Download matteobruni/tsparticles on GitHub">Download</a>
</div>
</div>
<script async="" defer="" src="https://buttons.github.io/buttons.js"></script>
/* ---- 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: #000;
}
.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;
}
tsParticles
.load("tsparticles", {
particles: {
move: {
enable: true,
speed: 0
},
links: {
enable: true
},
number: {
value: 0
}
}
})
.then(function (container) {
let angleX = Math.floor(Math.random() * 360);
setInterval(function () {
const angle = (angleX * Math.PI) / 180;
angleX += 5;
if (angleX > 360) angleX -= 360;
const particleSin = container.particles.addParticle(
{ x: 0, y: Math.sin(angle) * 100 + 200 },
{
color: {
value: "#f00"
},
links: {
id: "sin",
enable: true,
distance: 20,
color: "random"
},
move: {
enable: true,
speed: 1,
random: false,
straight: true,
direction: "right",
outMode: "destroy"
},
size: {
value: 1
}
}
);
const particleCos = container.particles.addParticle(
{ x: 0, y: Math.cos(angle) * 100 + 200 },
{
color: {
value: "#fff"
},
links: {
id: "cos",
enable: true,
distance: 20,
color: "random"
},
move: {
enable: true,
speed: 1,
straight: true,
direction: "right",
outMode: "destroy"
},
size: {
value: 1
}
}
);
const particleTan = container.particles.addParticle(
{ x: 0, y: Math.tan(angle) * 100 + 200 },
{
color: {
value: "#0f0"
},
links: {
id: "tan",
enable: true,
distance: 35,
color: "random"
},
move: {
enable: true,
speed: 1,
straight: true,
direction: "right",
outMode: "destroy"
},
size: {
value: 1
}
}
);
const particleAngle = container.particles.addParticle(
{ x: 0, y: Math.random() * angleX },
{
color: {
value: "#00f",
animation: {
enable: true,
speed: 50
}
},
links: {
enable: false
},
move: {
enable: true,
speed: 3,
straight: true,
direction: "right",
outMode: "destroy"
},
size: {
value: 5,
random: true
}
}
);
}, 100);
});