Created
September 18, 2011 12:41
-
-
Save moumar/1225043 to your computer and use it in GitHub Desktop.
Smokey
This file contains hidden or 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
| float x_noise, y_noise, radius_noise, angle_noise, angle; | |
| float ellipse_radius_noise_x, ellipse_radius_noise_y; | |
| float max_ellipse_radius; | |
| float radius_range, radius_range_noise; | |
| float dimension = 800; // this dimension is constant | |
| void setup() { | |
| //size(4200, 4200, JAVA2D); | |
| size(800, 800, JAVA2D); | |
| smooth(); | |
| } | |
| void reset() { | |
| x_noise = random(10); | |
| y_noise = random(10); | |
| radius_noise = random(10); | |
| angle_noise = random(10); | |
| angle = 0.1; | |
| ellipse_radius_noise_x = random(10); | |
| ellipse_radius_noise_y = random(10); | |
| radius_range = 0; | |
| radius_range_noise = random(10); | |
| max_ellipse_radius = dimension/35; | |
| background(255); | |
| } | |
| void draw() { | |
| smooth(); | |
| reset(); | |
| float scale = width/dimension; | |
| //while(angle < TWO_PI*6) { | |
| while (radius_range < dimension) { | |
| Ellipse e = draw_ellipse(); | |
| noFill(); | |
| stroke(0, 50); | |
| ellipse(e.x * scale, e.y * scale, e.ellipse_radius_x * scale, e.ellipse_radius_y * scale); | |
| } | |
| //JPEGRecorder.saveJPG(this, "images"); | |
| println("finished"); | |
| noLoop(); | |
| } | |
| Ellipse draw_ellipse() { | |
| float radius = lerp(radius_range*0.75, radius_range, noise(radius_noise+=0.01)); | |
| radius_range += lerp(0, 0.1, noise(radius_range_noise+=0.05)); | |
| angle_noise += 0.001; | |
| angle += lerp(0, 0.03*(TWO_PI/angle), noise(angle_noise+=0.001)); | |
| //angle += 0.01; | |
| float x = dimension*0.33 + cos(angle)*radius; | |
| float y = dimension*0.66 + sin(angle)*radius; | |
| //noStroke(); fill(100, 50); | |
| ellipse_radius_noise_x += 0.01; | |
| ellipse_radius_noise_y += 0.01; | |
| float ellipse_radius_x = noise(ellipse_radius_noise_x)*max_ellipse_radius; | |
| float ellipse_radius_y = noise(ellipse_radius_noise_y)*max_ellipse_radius; | |
| return new Ellipse(x, y, ellipse_radius_x, ellipse_radius_y); | |
| } | |
| void keyPressed() { | |
| loop(); | |
| } | |
| class Ellipse { | |
| float x, y, ellipse_radius_x, ellipse_radius_y; | |
| Ellipse(float x, float y, float ellipse_radius_x, float ellipse_radius_y) { | |
| this.x = x; | |
| this.y = y; | |
| this.ellipse_radius_x = ellipse_radius_x; | |
| this.ellipse_radius_y = ellipse_radius_y; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment