Last active
December 15, 2015 22:29
-
-
Save tonussi/5333100 to your computer and use it in GitHub Desktop.
MIT Media Labs Logo (Getting Closer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FlashLightRect { | |
float tamanho, path; | |
color rectcolor; | |
int x, y; | |
PVector caminho, direcao; | |
FlashLightRect (color c) { | |
tamanho = 100; | |
//muda as cores | |
rectcolor = c; | |
//~ | |
direcao = new PVector(width/2 + random(40), height/2 + random(40)); | |
caminho = new PVector(0, 0); | |
caminho.set(PVector.random2D()); | |
direcao.sub(caminho); | |
} | |
void desenha() { | |
fill(0, 10); | |
for (x = 0; x <= 100; x++) { | |
rect(width - x * 30, y, t, t); | |
} | |
y+=50%(height); | |
if (tamanho > 15) { | |
tamanho -= 0.7; | |
stroke(rectcolor); | |
fill(rectcolor); | |
direcao.add(caminho); | |
} | |
else { | |
stroke(0); | |
fill(0); | |
caminho.set(0, 0, 0); | |
} | |
rect(direcao.x, direcao.y, tamanho, tamanho); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FlashLightRect[] flr; | |
int estados, prox = 1; | |
float t; | |
void setup() { | |
size(350, 350); | |
if (frame != null) | |
frame.setResizable(true); | |
flr = new FlashLightRect[3]; | |
flr[0] = new FlashLightRect(color(247, 204, 1, 10)); | |
flr[1] = new FlashLightRect(color(0, 107, 171, 10)); | |
flr[2] = new FlashLightRect(color(211, 32, 38, 10)); | |
rectMode(CENTER); | |
background(#eee8d5); | |
} | |
void draw() { | |
flr[0].desenha(); | |
flr[1].desenha(); | |
flr[2].desenha(); | |
} | |
void mousePressed() { | |
background(#eee8d5); | |
flr[0] = new FlashLightRect(color(247, 204, 1, 10)); | |
flr[1] = new FlashLightRect(color(0, 107, 171, 10)); | |
flr[2] = new FlashLightRect(color(211, 32, 38, 10)); | |
} | |
void keyPressed() { | |
if (key == 's') { | |
this.set(0, 0, this.get(0, 0, width, height)); | |
this.save("pics/novas/frame-" + this.nf(frameCount, 4) + ".png"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment