mz-particles
Version:
TypeScript library for creating particle effects on canvas.
54 lines (48 loc) • 1.65 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<style>
html, body{
padding: 0;
margin: 0;
}
#placeholder{
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<div id="placeholder"></div>
<script src="../dist/mz-particles.min.js"></script>
<script>
window.particles({
$placeholder: document.getElementById('placeholder'),
canvasColor: 'rgb(17, 24, 39)',
particlesNumber: 100,
minSize: 10,
maxSize: 30,
particlesColors: [
'#CEA262', '#f3a73a', '#fffc00', '#92ccfa',
'#5daed2', '#366d8c'
],
// stars -------------
svgPathData: [
'm14.5 21.75-8.52289 4.48075 1.62773-9.49038-6.89516-6.72112 9.52888-1.38462L14.5 0l4.26144 8.63463 9.52888 1.38462-6.89516 6.72112 1.62773 9.49038z',
'M14.5 21.75 4.24695 24.75305 7.25 14.5 4.24695 4.24695 14.5 7.25l10.25305-3.00305L21.75 14.5l3.00305 10.25305z',
'm14.5 21.75-5.54891 6.14625.42239-8.26973-8.26973.42239L7.25 14.5 1.10375 8.95109l8.26973.42239-.42239-8.26973L14.5 7.25l5.54891-6.14625-.42239 8.26973 8.26973-.42239L21.75 14.5l6.14625 5.54891-8.26973-.42239.42239 8.26973z',
],
// effects ------------
rotate: true,
// scale effect -------
scaleInOut: true,
maxScale: 1.5,
minScale: 0.7,
scaleStep: 0.005,
});
</script>
</body>
</html>