Tyler Ben

Generation

generate functionTue, 01 Aug 2023

Make a binary star system sim 2d in p5.js

function setup() { createCanvas(800, 400); background(40); } function draw() { background(40); stroke(255); strokeWeight(4); // Center of mass push(); translate(width / 2, height / 2); fill(0); ellipse(0, 0, 16, 16); pop(); // Star push(); translate(width / 2, height / 2); noStroke(); fill(255, 128, 0); ellipse(100, 0, 32, 32); // Planet fill(0, 127, 255); ellipse(200, 0, 24, 24); pop(); }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant