Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage arrow;
- int edge = 40, sz = 25, frms = 90;
- float theta;
- void setup() {
- size(540, 540);
- arrow = loadImage("arrow.png");
- arrow.resize(sz, 0);
- imageMode(CENTER);
- }
- void draw() {
- background(200);
- for (int x=edge+sz; x<width-edge; x += sz*2) {
- for (int y=edge+sz; y<height-edge; y+= sz*2) {
- float distance = dist(x, y, width/2, height/2);
- float r = map(distance, 0, sqrt(sq(width/2)+sq(height/2)), 0, HALF_PI);
- pushMatrix();
- translate(x, y);
- rotate(theta+r);
- image(arrow, 0, 0);
- popMatrix();
- }
- }
- textAlign(RIGHT);
- fill(0, 150);
- text("p5art.tumblr.com", width-60, height-10);
- if (frameCount<=frms) saveFrame("image-###.gif");
- theta += TWO_PI/frms;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement