Created
January 2, 2019 11:07
-
-
Save andrusenn/ea599205be9bef3fb163edcc098a7222 to your computer and use it in GitHub Desktop.
WhiteNoise Series
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
/* | |
WhiteNoise Series | |
Algunos metodos / Some methods | |
Andrés Senn | |
2018/2019 | |
*/ | |
// CUT // CORTAR --------------------------------- | |
void cortar() { | |
float r = 2; | |
int i = 0; | |
for (int x = 0; x < width; x+=r) { | |
for (int y = 0; y < height; y+=r) { | |
if (dist(mouseX, mouseY, x, y)<2) { | |
// Fragments Size // Tamaños de los cortes ------------------------- | |
float r1 = random(2, 100); | |
float r2 = random(2, 100); | |
// New position // Nueva posicion de los cortes --------------------- | |
float nxi = map(noise(x*0.02, y*0.02), 0, 1, -20, 20)*cos(x*0.1); | |
float nyi = map(noise(x*0.02, y*0.02), 0, 1, -20, 20)*sin(x*0.1); | |
// Cuts // Cortes --------------------------------------------------- | |
PImage i1 = get(x-int(r1/2), y-int(r2/2), int(r1), int(r2)); | |
// ------------------------------------------------------------------ | |
rectMode(CENTER); | |
imageMode(CENTER); | |
noStroke(); | |
//Sombra / Shadow ----------------------------------------------- | |
fill(0, 10); | |
rect((x+nxi)+5, (y+nyi)+5, i1.width, i1.height); | |
// fragmentos / fragments --------------------------------------- | |
image(i1, int(x+nxi), int(y+nyi)); | |
strokeWeight(0.4); | |
// Negativos / Negatives ---------------------------------------- | |
if (brightness(g1.get(int(x), int(y)))>127) { | |
stroke(0, 50); | |
} else { | |
stroke(255, 50); | |
} | |
noFill(); | |
// Marco / Frame ------------------------------------------------- | |
rect((x+nxi), (y+nyi), i1.width, i1.height); | |
// Lineas / Lines ------------------------------------------------ | |
float rw = random(2, 8); | |
if (i % 10 == 0) { | |
fill(255, 255, 255, 20);// Red in HSB | |
line((x+nxi), (y+nyi), (x+nxi), (y+nyi)+300); | |
line((x+nxi), (y+nyi), (x+nxi)+300, (y+nyi)); | |
rect((x+nxi), (y+nyi)+300, rw, rw); | |
} | |
i++; | |
} | |
} | |
} | |
} | |
// NOISE CIRCLE / CIRCULO DE RUIDO ---------------------------- | |
void noiseCircle(float _x, float _y, float _d) { | |
for (int x = int(_x-_d/2); x < _x+_d/2; x++) { | |
for (int y = int(_y-_d/2); y < _y+_d/2; y++) { | |
float dis = dist(x, y, _x, _y); | |
if (dis < _d/2) { | |
int c = color(random(50, 255)); | |
fill(c); | |
noStroke(); | |
rect(x, y, 1.5, 1.5); | |
} | |
} | |
} | |
} | |
// NOISE RECT // RECTANGULO DE RUIDO -------------------------------------- | |
void noiseRect(float _x, float _y, float _w, float _h) { | |
for (int x = int(_x); x < _x+_w; x++) { | |
for (int y = int(_y); y < _y+_h; y++) { | |
int c = color(random(50, 255)); | |
fill(c); | |
noStroke(); | |
rect(x, y, 1.5, 1.5); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment