Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int edge = 100;
- int units = 200;
- int col;
- float unit_width, theta;
- RBStrain[] rainbow = new RBStrain[units];
- color palette[] = {#EFAC41 , #DE8531 , #B32900 , #6C1305 , #330A04};
- color bg = #202020;
- void setup() {
- size(500, 500);
- float max = width-2*edge;
- unit_width = max/units;
- for (int i=0; i<units; i++) {
- theta = random(TAU);
- float maxh = random(100,150);
- color col = palette[int(random(5))];
- rainbow[i]= new RBStrain(i, theta, col, maxh);
- }
- }
- void draw() {
- background(bg);
- for (int i=0; i<rainbow.length; i++) {
- rainbow[i].display();
- }
- //if (frameCount % 5 == 0 && frameCount < 241) saveFrame("image-####.gif");
- }
- class RBStrain {
- float i, theta, max;
- color col;
- RBStrain(float _i, float _theta, color _col, float _max) {
- i = _i;
- theta = _theta;
- col = _col;
- max = _max;
- }
- void display() {
- strokeWeight(.5);
- stroke(255,25);
- float rblength = map(sin(theta*2), -1, 1, 30, max);
- float alpha = map(sin(theta/2), -1, 1, 200, 255);
- float str = map(sin(theta/2), -1, 1, 10, 1);
- fill(col, alpha);
- rect(edge+(i*unit_width), height-edge, unit_width, -(edge/2+rblength));
- theta += 0.0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement