Skip to content

Commit

Permalink
adicionei o código do André Burnier
Browse files Browse the repository at this point in the history
  • Loading branch information
Introscopia committed Oct 6, 2020
1 parent 5152ba0 commit c42cde1
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
77 changes: 77 additions & 0 deletions 2020-09/liveCoding_raster/liveCoding_raster.pde
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 added 2020-09/liveCoding_vetor/.DS_Store
Binary file not shown.
Binary file added 2020-09/liveCoding_vetor/data/Arial Black.ttf
Binary file not shown.
54 changes: 54 additions & 0 deletions 2020-09/liveCoding_vetor/liveCoding_vetor.pde
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);
}

0 comments on commit c42cde1

Please sign in to comment.