Skip to content

Instantly share code, notes, and snippets.

@Chloeolhc
Created November 5, 2019 16:16
Show Gist options
  • Save Chloeolhc/c98fe0ee86e63093ea489b85c5497a1e to your computer and use it in GitHub Desktop.
Save Chloeolhc/c98fe0ee86e63093ea489b85c5497a1e to your computer and use it in GitHub Desktop.
Inter Lab Project
int x = 50;
int condition = 5;
int i=300;
int y=300;
int a=0;
int b=360;
float c=360;
float easing =0.05;
int d =10;
int j=10;
float s=-1;
void setup() {
size(600, 600);
background(0, 0, 0);
strokeWeight(25);
loop();
}
void draw() {
colorMode(HSB, 360, 100, 100);
background (360);
stroke(a, b, c);
ellipse(i, y, x, x);
if(a<=0||a>=250){
s=-1*s;
}
a+=s;
x += condition;
if ((x > 300) || (x<0)) {
condition *= -1;
}
}
void keyPressed() {
if (key==CODED) {
if (keyCode ==UP) {
ellipse(i, y--, x, x);
} else if (keyCode == DOWN) {
ellipse(i, y++, x, x);
} else if (keyCode == LEFT) {
ellipse(i--, y, x, x);
} else if (keyCode == RIGHT) {
ellipse(i++, y, x, x);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment