create speed parameter
This commit is contained in:
parent
24af3c33ac
commit
fe51090807
@ -8,7 +8,7 @@
|
|||||||
href="css/index.min.css"
|
href="css/index.min.css"
|
||||||
crossorigin="anonymous"/>
|
crossorigin="anonymous"/>
|
||||||
</head>
|
</head>
|
||||||
<body onload='particles(avoidMouse = false, hover = false)'>
|
<body onload='particles(false, false, 2, 0.5)'>
|
||||||
<canvas id="particles"></canvas>
|
<canvas id="particles"></canvas>
|
||||||
<!-- javascript -->
|
<!-- javascript -->
|
||||||
<script
|
<script
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function particles(avoidMouse = true, hover = true, particles = 2) {
|
function particles(avoidMouse = true, hover = true, particles = 2, speed = 0.5){
|
||||||
/* create particles animation
|
/* create particles animation
|
||||||
based on the amazing tutorial by 'Franks Labratory'
|
based on the amazing tutorial by 'Franks Labratory'
|
||||||
https://youtu.be/d620nV6bp0A
|
https://youtu.be/d620nV6bp0A
|
||||||
@ -79,8 +79,8 @@ function particles(avoidMouse = true, hover = true, particles = 2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// move particle
|
// move particle
|
||||||
this.x += this.directionX;
|
this.x += this.directionX * speed;
|
||||||
this.y += this.directionY;
|
this.y += this.directionY * speed;
|
||||||
|
|
||||||
// draw particle
|
// draw particle
|
||||||
this.draw();
|
this.draw();
|
||||||
|
Loading…
Reference in New Issue
Block a user