mirror of
https://github.com/Noratrieb/redox.git
synced 2026-01-14 16:25:04 +01:00
added mass
This commit is contained in:
parent
1888dca4e8
commit
10ca04b98e
5 changed files with 19 additions and 66 deletions
|
|
@ -7,11 +7,13 @@ const particles: Particle[] = [];
|
|||
|
||||
|
||||
export function particlesInit() {
|
||||
const chargeToMass = [0.1, 1, 10];
|
||||
for (let i = 0; i < 200; i++) {
|
||||
const charge = Math.random() < 0.3 ? 0 : Math.random() < 0.5 ? 1 : -1;
|
||||
particles.push(new Particle(new Vector(
|
||||
Math.random() * (CANVAS_WIDTH - 100) + 50,
|
||||
Math.random() * (CANVAS_HEIGHT - 100) + 50
|
||||
), Math.random() < 0.3 ? 0 : Math.random() < 0.6 ? -1 : 1));
|
||||
), charge, chargeToMass[charge - 1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue