-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5152ba0
commit c42cde1
Showing
4 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
Apresentado por André Burnier na Noite de Processing em 29/09/2020. | ||
*/ | ||
|
||
int div = 20; | ||
PGraphics orig; | ||
PImage[][] imgs = new PImage[div][div]; | ||
float[] pontos = new float[div]; | ||
float t = 0; | ||
|
||
void setup() { | ||
size(800, 800); | ||
|
||
orig = createGraphics(width, height); | ||
PFont fonte = createFont("Helvetica-Bold", height*0.3); | ||
orig.beginDraw(); | ||
orig.background(0); | ||
orig.fill(255); | ||
orig.noStroke(); | ||
orig.textAlign(CENTER); | ||
orig.textFont(fonte); | ||
orig.text("teste", width*0.5, height*0.6); | ||
orig.endDraw(); | ||
|
||
recortaImg(); | ||
} | ||
|
||
|
||
void draw() { | ||
background (0); | ||
//image(orig, 0, 0); | ||
calcPontos(); | ||
//int w = ceil(orig.width/div); | ||
float x = 0; | ||
float y = 0; | ||
for (int i = 0; i < div; i ++) { | ||
for (int j = 0; j < div; j ++) { | ||
image(imgs[i][j], x, y, pontos[i], pontos[j]); | ||
noFill(); | ||
stroke(255,0,0); | ||
rect(x, y, pontos[i], pontos[j]); | ||
y += pontos[j]; | ||
} | ||
y = 0; | ||
x += pontos[i]; | ||
} | ||
t +=0.005; | ||
} | ||
|
||
void calcPontos(){ | ||
float soma = 0; | ||
for(int i = 0; i < pontos.length; i ++){ | ||
float atual = norm(i,0,pontos.length); | ||
pontos[i] = pow(noise(atual,t), 4); | ||
soma += pontos[i]; | ||
} | ||
|
||
for(int i = 0; i < pontos.length; i ++){ | ||
float w = map(pontos[i], 0, soma, 0, width); | ||
pontos[i] = w; | ||
} | ||
|
||
} | ||
|
||
void recortaImg() { | ||
int w = ceil(orig.width/div); | ||
int x = 0; | ||
int y = 0; | ||
for (int i = 0; i < div; i ++) { | ||
for (int j = 0; j < div; j ++) { | ||
imgs[i][j] = orig.get(x, y, w, w); | ||
y +=w; | ||
} | ||
y = 0; | ||
x += w; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Apresentado por André Burnier na Noite de Processing em 29/09/2020. | ||
*/ | ||
|
||
import geomerative.*; | ||
RPoint[][] points; | ||
PVector mouse; | ||
float raio = 200; | ||
|
||
void setup() { | ||
size(800, 800); | ||
RG.init(this); | ||
|
||
String txt = "O"; | ||
int txtSize = 700; | ||
|
||
RShape grp = RG.getText(txt, "Arial Black.ttf", txtSize, CENTER); | ||
//RG.setPolygonizer(RG.UNIFORMLENGTH); | ||
RG.setPolygonizerLength(4); | ||
|
||
points = grp.getPointsInPaths(); | ||
|
||
mouse = new PVector(0,0); | ||
} | ||
|
||
void draw() { | ||
background(255); | ||
noStroke(); | ||
fill(0); | ||
translate(width*0.5, height*0.8); | ||
//mouse.set(mouseX-width*0.5, mouseY-height*0.8); | ||
mouse.set(mouseX - screenX(0, 0), mouseY - screenY(0, 0)); | ||
|
||
beginShape(); | ||
for (int i = 0; i < points.length; i ++) { | ||
if (i>0) beginContour(); | ||
for (int j = 0; j < points[i].length; j++) { | ||
//float x = points[i][j].x; | ||
//float y = points[i][j].y; | ||
PVector pos = new PVector(points[i][j].x, points[i][j].y); | ||
|
||
PVector posMouse = PVector.sub(pos,mouse); | ||
float dist = posMouse.mag(); | ||
if (dist < raio){ | ||
float t = map(dist, 0, raio, 100, 0); | ||
posMouse.setMag(t); | ||
pos.add(posMouse); | ||
} | ||
vertex(pos.x,pos.y); | ||
} | ||
if (i>0) endContour(); | ||
} | ||
endShape(CLOSE); | ||
} |