Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float unit, theta;
- int num = 20;
- void setup() {
- size(500, 500);
- unit = width/num;
- noStroke();
- }
- void draw() {
- background(0);
- for (int y=0; y<=num; y++) {
- for (int x=0; x<=num; x++) {
- float distance = dist(width/2, height/2, x*unit, y*unit);
- float offSet = map(distance, 0, sqrt(sq(width/2)+sq(height/2)), 0, TWO_PI);
- float sz = map(sin(theta+offSet), -1, 1, unit*.1, unit*.9);
- float start = map(sin(theta+offSet), -1, 1, 0, PI);
- float lerpAmount = map(distance, 0, width/2+height/2, 0, 1);
- color col = lerpColor(#FCE400, #C60C0C, lerpAmount);
- fill(col);
- if (y>num/2) {
- arc(x*unit, y*unit, sz, sz, start, start+PI);
- } else {
- arc(x*unit, y*unit, sz, sz, 0, start+PI);
- }
- }
- }
- theta -= 0.0523;
- //if (frameCount%2==0 && frameCount<121) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement