Skip to content

Commit 3afb25f

Browse files
fix particles out of canvas / best regenerate
1 parent ff63ade commit 3afb25f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

particles.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ function launchParticlesJS(tag_id, params){
226226
p.y += p.vy * (pJS.particles.anim.speed/2);
227227

228228
/* change particle position if it is out of canvas */
229-
if(p.x + p.radius > pJS.canvas.w) p.x = p.radius;
230-
else if(p.x - p.radius < 0) p.x = pJS.canvas.w - p.radius;
231-
if(p.y + p.radius > pJS.canvas.h) p.y = p.radius;
232-
else if(p.y - p.radius < 0) p.y = pJS.canvas.h - p.radius;
229+
if(p.x - p.radius > pJS.canvas.w) p.x = p.radius;
230+
else if(p.x + p.radius < 0) p.x = pJS.canvas.w + p.radius;
231+
if(p.y - p.radius > pJS.canvas.h) p.y = p.radius;
232+
else if(p.y + p.radius < 0) p.y = pJS.canvas.h + p.radius;
233233

234234
/* Check distance between each particle and mouse position */
235235
for(var j = i + 1; j < pJS.particles.array.length; j++){

particles.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)