Diferencia entre revisiones de «Francisco Casas - Experimento "Paint"»
(Página creada con '{{Proyecto |Título=Experimento Paint |Tipo de Proyecto=Proyecto de Curso |Palabras Clave=tarea 4 |Año de Inicio=2012 |Carreras Relacionadas=Arquitectura |Asignaturas Relaciona...') |
Sin resumen de edición |
||
Línea 11: | Línea 11: | ||
}} | }} | ||
<nowiki><pre> | |||
int bwbar; | int bwbar; | ||
int colorbar; | int colorbar; | ||
Línea 102: | Línea 103: | ||
} | } | ||
} | } | ||
</pre></nowiki> |
Revisión del 10:04 19 abr 2012
Título | Experimento Paint |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 4 |
Período | 2012- |
Asignatura | Imagen Escrita 2012, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Francisco Casas |
Profesor | Herbert Spencer |
<pre>
int bwbar;
int colorbar;
int s;
void setup() {
size(600, 600);
background(255);
//smooth();
}
void draw() {
colorfields();
if (mousePressed) {//darkness/lightness
if (mouseY > 1 && mouseY<height/20 && mouseX < width-1 && mouseX > width/20) {
bwbar = abs(mouseX % width);
}
}
if (mousePressed) { //color select
if (mouseY < height-1 && mouseY>height/20 && mouseX < width/20 && mouseX >1) {
colorbar = abs(mouseY % height);
}
}
stroke(0);
noFill();
strokeWeight(2);
rect(width/20+1, height/20+1, width, height);
stroke(255);
strokeWeight(0);
line(bwbar+1, 0, bwbar+1, height/20-2);
line(bwbar-1, 0, bwbar-1, height/20-2);
line(0, colorbar-1, width/20-2, colorbar-1);
line(0, colorbar+1, width/20-2, colorbar+1);
color x;
color y;
color z;
y = get(0, colorbar);
x = get(bwbar, 0);
z = blendColor(x, y, OVERLAY);
fill(z);
rect (0, 0, width/20, height/20);
drawing();
}
void keyReleased() {
s ++;
if (key == 's' || key == 'S') {
PImage partialSave = get(width/20+2, width/20+2, width, height);
partialSave.save("pic" + s);
}
}
void colorfields() {
color black;
color white;
black = #000000;
white = #FFFFFF;
for (int x = 0+width/20; x < width; x++) {
float percent = norm(x, 0, width);
stroke(lerpColor(black, white, percent, HSB));
line(x, 0, x, height/20);
}
color one = #0033ee;
color two = #00ee33;
one = #ff0000;
two = #00ff00;
for (int y=0+height/20;y < height; y++) {
float percent2 = norm (y, 0, height/3);
stroke(lerpColor(one, two, percent2, HSB));
line(0, y, width/20, y);
}
}
void drawing() {
if (mousePressed) {
if (mouseX > width/20+1 && mouseY>height/20+1) {
stroke(get(1, 1));
strokeWeight(10);
line(pmouseX, pmouseY, mouseX, mouseY);
stroke(255);
strokeWeight(5);
}
}
}
</pre>