Comment section
This commit is contained in:
parent
677ad4ab06
commit
c660d9a296
@ -2,9 +2,9 @@
|
|||||||
ANIMATION LOGIN - PARTICLE BACKGROUND SYSTEM
|
ANIMATION LOGIN - PARTICLE BACKGROUND SYSTEM
|
||||||
==========================================
|
==========================================
|
||||||
fungsi:
|
fungsi:
|
||||||
- Class Particle: Objek partikel dengan posisi & kecepatan
|
- Class Particle: objek partikel dengan posisi & kecepatan
|
||||||
- Even Distribution: Distribusi partikel merata (15x10 grid)
|
- Even Distribution: distribusi partikel merata (15x10 grid)
|
||||||
- Animate Loop: Pergerakan smooth dengan requestAnimationFrame
|
- Animate Loop: pergerakan smooth dengan requestAnimationFrame
|
||||||
========================================== */
|
========================================== */
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class Particle {
|
|||||||
this.x += this.vx;
|
this.x += this.vx;
|
||||||
this.y += this.vy;
|
this.y += this.vy;
|
||||||
|
|
||||||
// ♻️ WRAP-AROUND LOGIC
|
// WRAP-AROUND LOGIC
|
||||||
// Kalau keluar dari kiri → muncul dari kanan
|
// Kalau keluar dari kiri → muncul dari kanan
|
||||||
if (this.x < -10) this.x = window.innerWidth + 10;
|
if (this.x < -10) this.x = window.innerWidth + 10;
|
||||||
// Kalau keluar dari kanan → muncul dari kiri
|
// Kalau keluar dari kanan → muncul dari kiri
|
||||||
@ -119,7 +119,7 @@ for (let i = 0; i < rows; i++) {
|
|||||||
|
|
||||||
const particle = new Particle();
|
const particle = new Particle();
|
||||||
|
|
||||||
// ⚙️ DISTRIBUSI MERATA + RANDOM OFFSET
|
// DISTRIBUSI MERATA + RANDOM OFFSET
|
||||||
// Formula: (index / total) × lebar/tinggi layar
|
// Formula: (index / total) × lebar/tinggi layar
|
||||||
particle.x = (j / cols) * window.innerWidth + (Math.random() - 0.5) * 100;
|
particle.x = (j / cols) * window.innerWidth + (Math.random() - 0.5) * 100;
|
||||||
particle.y = (i / rows) * window.innerHeight + (Math.random() - 0.5) * 100;
|
particle.y = (i / rows) * window.innerHeight + (Math.random() - 0.5) * 100;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user