Skip to content

Instantly share code, notes, and snippets.

@tgb20
Last active January 28, 2025 17:14
Show Gist options
  • Save tgb20/91509355eab1dcd21075ea606e47868c to your computer and use it in GitHub Desktop.
Save tgb20/91509355eab1dcd21075ea606e47868c to your computer and use it in GitHub Desktop.
P5 Radar Test
// Bubbles
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
fill('green')
rect(0, 0, 200, 400);
fill(0)
rect(200, 0, 200, 400);
blendMode(DIFFERENCE);
fill('green');
noStroke();
noCursor()
circle(mouseX, mouseY, 40)
blendMode(BLEND);
}
// RADAR
let angle = 0;
function setup() {
createCanvas(1024, 1024);
}
function draw() {
// Background
fill(0)
noStroke()
circle(512, 512, 512)
// Green sweep
fill('green')
arc(512, 512, 1024, 1024, radians(-90 + angle), radians(angle));
// Sweeping Arm
stroke(255)
strokeWeight(8);
let xArm = 512 * cos(radians(angle)) + 512;
let yArm = 512 * sin(radians(angle)) + 512;
line(xArm, yArm, 512, 512)
angle += 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment