Jump to content
  • entry
    1
  • comments
    2
  • views
    221

About this blog

Where I post some stuff I code

Entries in this blog

Gravity Simulation

A gravity simulation I made. function setup() { createCanvas(800, 800, $("#main")) setInterval(draw2, 5); noStroke() } let particles = [[0, 0, 0, 0, 50]]; let newParticles = [...particles]; const gravitational_constant = 2; //Randomly spawns particles on the canvas function addDust(num) { for (let i = 0; i < num; i++) { let x = [Math.random() * 400 - 200, Math.random() * 400 - 200, Math.random() * 2 - 1, Math.random() * 2 - 1, 0.1] particles.push(x)
×
×
  • Create New...