Index / 2017 / Finding Angles
500×500 · p5.js instance mode
Finding_Angles.pde 24 lines
int x, y;
 
void setup() {
  size(500, 500);
  x = width/2;
  y = height/2;
  textSize(20);
  textAlign(CENTER, CENTER);
  noStroke();
  smooth();
}
 
void draw() {
  background(255);
  float angle = atan2(mouseY-y, mouseX-x);
  translate(x, y);
  fill(0);
  ellipse(0, 0, 100, 100);
  fill(255);
  text(int(degrees(angle)), 0, 0);
  rotate(angle);
  fill(0, 0, 255);
  ellipse(50, 0, 30, 30);
}
read-only archive source from /2017/Useful References/Finding_Angles/Finding_Angles.pde

Description

This page is generated from the Processing project folder at /2017/Useful References/Finding_Angles/Finding_Angles.pde.

Archive

No companion assets were found in this sketch folder.