Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int c, num=2500;
- PImage img;
- PVector[] start;
- PVector[] end;
- color[] col=new color[num];
- float lerpValue, angle;
- void setup() {
- randomSeed(20);
- size(500, 500);
- background(255);
- img = loadImage("earth.jpg");
- colorMode(HSB, 100, 100, 100);
- start = new PVector[num];
- end = new PVector[num];
- while (c<num) {
- int x = (int)random(width);
- int y = (int)random(height);
- color br = img.get(x, y);
- if (brightness(br)<50) {
- float _x = width/2 + sin(angle)*width*.5;
- float _y = height/2 + cos(angle)*height*.5;
- start[c] = new PVector(_x, _y);
- end[c]= new PVector(x, y);
- col[c] = br;
- c++;
- angle += radians(1.7);
- }
- }
- }
- void draw() {
- //background(#ffffff);
- fill(#ffffff, 100);
- noStroke();
- rect(0, 0, width, height);
- for (int i=0; i<c; i++) {
- fill(#202020);
- noStroke();
- float currentX = lerp(start[i].x, end[i].x, lerpValue);
- float currentY = lerp(start[i].y, end[i].y, lerpValue);
- ellipse(currentX, currentY, 3, 3);
- }
- lerpValue += 0.006;
- if (lerpValue>1) noLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment