Created
February 20, 2018 05:36
-
-
Save anonymous/364097deca7fa49d10321768ff65fa8f to your computer and use it in GitHub Desktop.
Circle is generated of random dots
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
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