Skip to content

Instantly share code, notes, and snippets.

@KayceeCC
Created April 17, 2019 15:10
Show Gist options
  • Save KayceeCC/178d86fcd149951ae380d8032ad5bf11 to your computer and use it in GitHub Desktop.
Save KayceeCC/178d86fcd149951ae380d8032ad5bf11 to your computer and use it in GitHub Desktop.
String[] lines;
int xpos=300;
int ypos=350;
void setup() {
size(600, 600);
background(200, 50, 50);
rectMode(CENTER);
}
void drawcircle(int x, int y, int c, int d) {
stroke(255);
strokeWeight(5);
fill(200, 50, 50);
ellipse(x, y, c, d);
}
void draw() {
drawcircle(200, 250, 100, 100);
drawcircle(400, 250, 100, 100);
float ex1= map (mouseX, 0, width, 170, 230);
float ey1= map (mouseY, 0, height, 220, 280);
noStroke();
fill(255);
ellipse(ex1, ey1, 25, 25);
float ex2= map (mouseX, 0, width, 370, 430);
float ey2= map (mouseY, 0, height, 220, 280);
noStroke();
fill(255);
ellipse(ex2, ey2, 25, 25);
noStroke();
fill(255);
rect(300, 500, 150, 50, 25);
String a= "CLICK ME";
fill(200, 50, 50);
text(a, 350, 520, 150, 50);
if (mouseX>225 && mouseX<375 &&mouseY>475 &&mouseY<525==true) {
cursor(HAND);
if (mousePressed==true) {
stroke(255);
strokeWeight(5);
bezier(200,450,300,500,600,400,200,450);
}
} else {
cursor(ARROW);
}
}
void keyPressed() {
background(200, 50, 50);
fill(255);
ellipse(xpos,ypos,100,100);
if (keyCode==UP) {
ypos=ypos-5;
}
if (keyCode==DOWN) {
ypos=ypos+5;
}
if (keyCode==RIGHT) {
xpos=xpos+5;
}
if (keyCode==LEFT) {
xpos=xpos-5;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment