Last active
January 28, 2025 17:14
-
-
Save tgb20/91509355eab1dcd21075ea606e47868c to your computer and use it in GitHub Desktop.
P5 Radar Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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