Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tileCount;
- float tileWidth, tileHeight, shapeSize;
- float newShapeSize = shapeSize;
- float shapeAngle = 0;
- float maxDist, angle, x, y, radius, theta;
- color shapeColor = color(0, 130, 164);
- int fillMode = 0;
- int sizeMode = 0;
- void setup() {
- size(500, 500);
- background(#202020);
- smooth();
- tileCount = 15;
- shapeSize = width/tileCount;
- tileWidth = width/float(tileCount);
- tileHeight = height/float(tileCount);
- maxDist = sqrt(sq(width)+sq(height));
- radius = width/3;
- }
- void draw() {
- background(#202020);
- for (int gridY=0; gridY<tileCount; gridY++) {
- for (int gridX=0; gridX<tileCount; gridX++) {
- float posX = tileWidth*gridX + tileWidth/2;
- float posY = tileHeight*gridY + tileWidth/2;
- newShapeSize = shapeSize*.8;
- x = width/2 + sin(theta)*radius;
- y = height/2 + cos(theta)*radius;
- angle = atan2(y-posY, x-posX) + radians(shapeAngle);
- float a = map(dist(x, y, posX, posY), 0, maxDist, 0, 1);
- //fill(shapeColor, a);
- noFill();
- if (a>.4 || a<.1) {
- fill(#F5D014);
- strokeWeight(2);
- stroke(255);
- }
- else
- {
- //fill(0);
- noStroke();
- }
- pushMatrix();
- translate(posX, posY);
- //rotate (angle);
- rectMode(CENTER);
- //noStroke();
- rect(0, 0, newShapeSize, newShapeSize);
- popMatrix();
- }
- }
- theta += 0.0523/2;
- //angle += 0.01;
- if (frameCount % 4 == 0 && frameCount < 241) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement