Diferencia entre revisiones de «Francisco Casas - Experimento "Paint"»

De Casiopea
 
(No se muestran 2 ediciones intermedias de 2 usuarios)
Línea 2: Línea 2:
 
|Título=Experimento Paint
 
|Título=Experimento Paint
 
|Tipo de Proyecto=Proyecto de Curso
 
|Tipo de Proyecto=Proyecto de Curso
|Palabras Clave=tarea 4
+
|Palabras Clave=tarea 4, experimento
 
|Año de Inicio=2012
 
|Año de Inicio=2012
 
|Carreras Relacionadas=Arquitectura
 
|Carreras Relacionadas=Arquitectura
|Asignaturas Relacionadas=Imagen Escrita 2012,  
+
|Asignaturas Relacionadas=Imagen Escrita 2012,
|Cursos Relacionados=Imagen Escrita 2012,  
+
|Cursos Relacionados=Imagen Escrita 2012,
|Profesor=Herbert Spencer,  
+
|Profesor=Herbert Spencer,
|Alumnos=Francisco Casas,  
+
|Alumnos=Francisco Casas,
 +
|Imagen=Dolan.png
 
}}
 
}}
 
 
<pre><nowiki>
 
<pre><nowiki>
 
int bwbar;
 
int bwbar;
Línea 17: Línea 17:
  
 
void setup() {
 
void setup() {
size(600, 600);
+
  size(600, 600);
background(255);  
+
  background(255);  
//smooth();
+
  //smooth();
 
}
 
}
  
 
void draw() {
 
void draw() {
colorfields();
+
  colorfields();
  
if (mousePressed) {//darkness/lightness
+
  if (mousePressed) {//darkness/lightness
if (mouseY > 1 && mouseY<height/20 && mouseX < width-1 && mouseX > width/20) {
+
    if (mouseY > 1 && mouseY<height/20 && mouseX < width-1 && mouseX > width/20) {
bwbar = abs(mouseX % width);
+
      bwbar = abs(mouseX % width);
}
+
    }
}  
+
  }  
  
if (mousePressed) { //color select
+
  if (mousePressed) { //color select
if (mouseY < height-1 && mouseY>height/20 && mouseX < width/20 && mouseX >1) {
+
    if (mouseY < height-1 && mouseY>height/20 && mouseX < width/20 && mouseX >1) {
colorbar = abs(mouseY % height);
+
      colorbar = abs(mouseY % height);
}
+
    }
}
+
  }
  
stroke(0);       
+
  stroke(0);       
noFill();
+
  noFill();
strokeWeight(2);
+
  strokeWeight(2);
rect(width/20+1, height/20+1, width, height);
+
  rect(width/20+1, height/20+1, width, height);
stroke(255);
+
  stroke(255);
strokeWeight(0);   
+
  strokeWeight(0);   
line(bwbar+1, 0, bwbar+1, height/20-2);
+
  line(bwbar+1, 0, bwbar+1, height/20-2);
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);
line(0, colorbar+1, width/20-2, colorbar+1);
+
  line(0, colorbar+1, width/20-2, colorbar+1);
  
color x;
+
  color x;
color y;
+
  color y;
color z;
+
  color z;
  
y = get(0, colorbar);
+
  y = get(0, colorbar);
x = get(bwbar, 0);
+
  x = get(bwbar, 0);
z = blendColor(x, y, OVERLAY);
+
  z = blendColor(x, y, OVERLAY);
fill(z);
+
  fill(z);
rect (0, 0, width/20, height/20);
+
  rect (0, 0, width/20, height/20);
drawing();
+
  drawing();
 
}
 
}
  
 
void keyReleased() {
 
void keyReleased() {
s ++;
+
  s ++;
if (key == 's' || key == 'S') {
+
  if (key == 's' || key == 'S') {
PImage partialSave = get(width/20+2, width/20+2, width, height);
+
    PImage partialSave = get(width/20+2, width/20+2, width, height);
partialSave.save("pic" + s);
+
    partialSave.save("pic" + s);
}
+
  }
 
}
 
}
  
 
void colorfields() {
 
void colorfields() {
color black;
+
  color black;
color white;
+
  color white;
black = #000000;
+
  black = #000000;
white = #FFFFFF;
+
  white = #FFFFFF;
  
for (int x = 0+width/20; x < width; x++) {
+
  for (int x = 0+width/20; x < width; x++) {
float percent = norm(x, 0, width);
+
    float percent = norm(x, 0, width);
stroke(lerpColor(black, white, percent, HSB));
+
    stroke(lerpColor(black, white, percent, HSB));
line(x, 0, x, height/20);
+
    line(x, 0, x, height/20);
}
+
  }
  
color one = #0033ee;
+
  color one = #0033ee;
color two = #00ee33;
+
  color two = #00ee33;
one = #ff0000;
+
  one = #ff0000;
two = #00ff00;
+
  two = #00ff00;
  
for (int y=0+height/20;y < height; y++) {
+
  for (int y=0+height/20;y < height; y++) {
float percent2 = norm (y, 0, height/3);
+
    float percent2 = norm (y, 0, height/3);
stroke(lerpColor(one, two, percent2, HSB));
+
    stroke(lerpColor(one, two, percent2, HSB));
line(0, y, width/20, y);
+
    line(0, y, width/20, y);
}
+
  }
 
}
 
}
  
 
void drawing() {
 
void drawing() {
if (mousePressed) {
+
  if (mousePressed) {
if (mouseX > width/20+1 && mouseY>height/20+1) {
+
    if (mouseX > width/20+1 && mouseY>height/20+1) {
stroke(get(1, 1));
+
      stroke(get(1, 1));
strokeWeight(10);
+
      strokeWeight(10);
line(pmouseX, pmouseY, mouseX, mouseY);
+
      line(pmouseX, pmouseY, mouseX, mouseY);
stroke(255);
+
      stroke(255);
strokeWeight(5);
+
      strokeWeight(5);
}
+
    }
}
+
  }
 
}
 
}
  
</pre></nowiki>
+
</nowiki></pre>

Revisión actual del 12:12 19 abr 2012


Dolan.png


TítuloExperimento Paint
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 4, experimento
Período2012-
AsignaturaImagen Escrita 2012
Del CursoImagen Escrita 2012
CarrerasArquitectura
Alumno(s)Francisco Casas
ProfesorHerbert Spencer
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);
    }
  }
}