Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList bows = new ArrayList();
- int fr;
- int step = 100;
- boolean clicked = false;
- void setup() {
- size(500, 500);
- background(#202020);
- strokeCap(SQUARE);
- //strokeWeight(step/4);
- strokeWeight(2);
- bows.clear();
- for (int x=0; x<width+1; x += step) {
- for (int y=0; y<height+1; y += step) {
- for (int i=0; i<4; i++) {
- Bow bow = new Bow(x, y, i*PI/2, (i+1)*PI/2, random(1));
- bows.add(bow);
- }
- }
- }
- }
- void draw() {
- background(#202020);
- for (int i=0; i<bows.size();i++) {
- Bow bow = (Bow) bows.get(i);
- bow.display();
- }
- if (clicked==true) {
- if (frameCount % 2 == 0 && frameCount < fr+121) saveFrame("image-####.gif");
- }
- }
- void mousePressed() {
- setup();
- }
- void keyPressed() {
- fr = frameCount;
- clicked = true;
- }
- class Bow {
- int x, y;
- float r, start, end, end2, theta;
- Bow(int _x, int _y, float _start, float _end, float _r) {
- x = _x;
- y = _y;
- start = _start;
- end = _end;
- r = _r;
- }
- void display() {
- noFill();
- int c = 0;
- if (r > .35) {
- stroke(#f5e638);
- if (r > .5) {
- end2 = map(sin(theta), -1, 1, start, end);
- }
- else {
- end2 = end;
- }
- }
- else {
- noStroke();
- }
- arc(x, y, step, step, start, end2);
- theta += 0.0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement