Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2018 05:36
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 anonymous/364097deca7fa49d10321768ff65fa8f to your computer and use it in GitHub Desktop.
Save anonymous/364097deca7fa49d10321768ff65fa8f to your computer and use it in GitHub Desktop.
Circle is generated of random dots
PVector location;
PVector velocity;
float rad;
int h = 0;
void setup() {
size(900,900);
//HSB color mode is a simple way to go through the entire
//color scheme just by changing one variable.
colorMode(HSB, 360, 100, 100);
background(0,0,12);
smooth();
}
void draw() {
// looped circular movement
println(frameCount);
rad = radians(frameCount);
// size of the circle, >350 – bigger, <350 – smaller.
float x = width/2 + (350* cos(rad));
float y = height/2 + (350 * sin(rad));
location = new PVector(x, y);
// velocity also determines the width of the ring.
velocity = new PVector(random(-50, 200), random(-50, 20));
location.add (velocity);
stroke(h, 90, 90);
fill(h, 90, 90);
// size of the balls.
ellipse(location.x, location.y, 10, 10);
// when x reaches it max (completeting a full circle)
// the color changes.
if (x > 799.94) {
h = h + 10;
}
// color reset
if ( h > 360) {
h = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment