Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int numElem = 50;
- myArc[] myArcs = new myArc[numElem];
- color bg = #202020;
- color[] palette = {
- #F58F12, #0B9EE7, #4EA731, #F4D910, #F334E3
- };
- float org_x, org_y, diam;
- void setup() {
- size(500, 500);
- background(bg);
- noFill();
- strokeCap(SQUARE);
- org_x = width/2;
- org_y = height/2;
- diam = width*.6;
- float end = 0;
- float start = 0;
- float theta = 0;
- for (int i=0; i<numElem; i++) {
- color s = palette[i% palette.length ];
- start = end;
- end = start + TAU/numElem;
- myArcs[i]= new myArc(s, start, end, theta);
- theta += TAU/numElem;
- }
- }
- void draw() {
- background(bg);
- for (int i=0; i<numElem; i++) {
- myArcs[i].run();
- }
- //if (frameCount % 2 == 0 & frameCount<241) saveFrame("image-####.gif");
- }
- class myArc {
- float start, end, theta, sw;
- color s;
- myArc(color _s, float _start, float _end, float _theta) {
- s = _s;
- start = _start;
- end = _end + radians(.3);
- theta = _theta;
- }
- void run() {
- move();
- display();
- }
- void move() {
- sw = map(sin(theta*7), -1, 1, 20, 100);
- theta += 0.0523/2;
- }
- void display() {
- stroke(s);
- strokeWeight(sw);
- arc(org_x, org_y, diam, diam, start, end);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement