Created
November 5, 2019 16:16
-
-
Save Chloeolhc/c98fe0ee86e63093ea489b85c5497a1e to your computer and use it in GitHub Desktop.
Inter Lab Project
This file contains 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
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