Skip to content

Instantly share code, notes, and snippets.

@Jl9549
Created April 15, 2019 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jl9549/58e8beb374a81da5f7fd64a142dca874 to your computer and use it in GitHub Desktop.
Save Jl9549/58e8beb374a81da5f7fd64a142dca874 to your computer and use it in GitHub Desktop.
Movable Rainbow Circle
int z = 300;
boolean a = false;
int x = 300;
int y = 300;
int c = 0;
void setup()
{
size(600, 600);
frameRate(60);
colorMode(HSB, 100);
}
void draw()
{
background(100);
strokeWeight(20);
stroke(c, 100, 100);
circle(x, y, z);
if ( z <= 300 && z >= 100 && a == false)
{
z--;
z--;
c++;
if (z == 100)
{
a = true;
}
}
if (z >= 100 && z <= 300 && a == true)
{
z++;
z++;
c--;
if (z == 300)
{
a = false;
}
}
if(key == CODED && keyPressed == true)
{
if(keyCode == RIGHT)
{
x+=3;
}
else if(keyCode == LEFT)
{
x-=3;
}
else if(keyCode == UP)
{
y-=3;
}
else if(keyCode == DOWN)
{
y+=3;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment