sábado, 14 de diciembre de 2013

0
Evaluación





Evaluación

Sres y Srtas

El día Martes 17 del presente mes se procederá a realizar la Evaluación Final del Módulo de Programación Java, en el horario normal de clases.

Suerte a todos
CLIC AQUÍ PARA LEER MÁS

martes, 10 de diciembre de 2013

0
20 Adicionales mouseX, mouseY,




curve(x1, y1, x2, y2, x3, y3, x4, y4);
    


Para la función de curve( ), el primer (x1) y segundo (y1) parámetro especifica el punto de la curva y los dos últimos parámetros (x4, y4), especifican el segundo punto de la curva. 
Los parámetros de en medio establecen los puntos para definir la forma de la curva.

De manera similar, podemos realizr con:

beginShape(POLYGON);
curveVertex(84, 91);
curveVertex(68, 19);
curveVertex(21, 17);
curveVertex(32, 100);
endShape( ); 



ACTIVIDAD REALIZAR LA SIGUIENTE CURVA  

 

 

mouseX, mouseY,



Como ya se ha visto anteriormente en algunos ejemplos, los métodos de processing mouseX y mouseY, almacenan la coordenada x e y del cursor en relación con el origen en la esquina superior izquierda de la ventana de display.
Para ver los valores reales producidos mientras se mueve el ratón, Ej este programa para imprimir los valores en la consola:

void draw() {
println(mouseX + " : " + mouseY);
}



Se puede realizar operaciones tanto con mouseX, como mouseY, por ejemplo mouseX*2 u otra operación, de manera similar con Y.

Mueve 2 círculos, cuando se mueve el puntero:

void setup(){
  size(100, 100);
  noStroke();
  smooth();
 }
 void draw(){
  float x = mouseX;
  float y = mouseY;
  float ix = width - mouseX; 
  float iy = mouseY - height; 
  background(126);
  fill(255, 150);
  ellipse(x, height/2, y, y);
  fill(0, 159);
  ellipse(ix, height/2, iy, iy);
 }


Cuadrado es dibujado por donde el ratón vaya.

Si presiona el ratón el cuadrado se cambia a color negro.

void draw( ) {
    background(190);
    rect(mouseX-5, mouseY-5, 10, 10);
}

void mousePressed( ) {
    fill(0);
}
void mouseReleased( ) {
    fill(255);
}



 
En este ejemplo el cuadrado cambia a rojo oscuro si cualquier tecla está siendo presionada.

void draw( ) {
    if(keyPressed) {
        fill(102, 0, 0);
    } else {
        fill(204, 102, 0);
    }
    rect(30, 20, 55, 55);
}




 Analizar lo que hacen estos códigos


 void setup(){
 size(200,200);
 noFill();
 }
 void draw(){
 background(230);
  int x,y,x1,y1;
 x=200-mouseX-25;
 y=200-mouseY-25;
 x1=mouseX-25;
 y1=mouseY-25;
 rect(x,25,50,50);
 rect(x1,125,50,50);
 rect(25,y,50,50);
 rect(125,y1,50,50);
 }




void setup(){
  size(200,200);
}
void draw(){
  background(230);
  for(int i=0;i<=200;i+=20){
      for(int j=0;j<=200;j+=20){
        line(i,j,mouseX,mouseY);
      }
  }
  }





void setup(){
  size(100, 100);
  smooth();
  noStroke();
 }
 void draw(){
  background(126);
  translate(mouseX, mouseY);
  ellipse(0, 0, 33, 33);
 }
 


 void setup(){
  size(100, 100);
  strokeWeight(8);
  smooth();
 }
 void draw(){
  background(204);
  float angulo = map(mouseX, 0, width, 0, TWO_PI);
  translate(50, 50);
  rotate(angulo);
  line(0, 0, 40, 0);
 }



translate(45, 60);
rect(-35, -5, 70, 10);
rotate(-PI/8);
rect(-35, -5, 70, 10);
rotate(-PI/8);
rect(-35, -5, 70, 10);




noFill();
translate(50, 30);
rect(-10, 5, 20, 10);
scale(2.5);
rect(-10, 5, 20, 10);



 background(0);
smooth();
stroke(255, 120);
translate(66, 33); 
for (int i = 0; i < 18; i++) { 
  strokeWeight(i); 
  rotate(PI/12); 
  line(0, 0, 55, 0);
}


float y = 0.0;
void draw() {
    line(0, y, 100, y);
  y = y + 0.5;
}
 

CLIC AQUÍ PARA LEER MÁS

jueves, 5 de diciembre de 2013

0
19 Mas sentencias



SENTENCIAS

strokeJoin(BEVEL); strokeJoin(MITER); strokeJoin(ROUND);

Para efectos de esquinas.


smooth();
size(300,300);
strokeWeight(12);
strokeJoin(BEVEL);
rect(15, 10, 45, 35);
strokeJoin(MITER);
rect(15, 80, 45, 180);
strokeJoin(ROUND);
rect(100, 100, 145, 150);


SENTECIA PFont 

Para establecer la fuente.
PFont font; // Declarar
font = loadFont("tipo de fuente.vlw"); // carga el tipo de font
textFont(font); // El texto lo pone con el tipo de fuente escogido
textSize(tamaño); // para el tamaño

.
Ziggurat-32.vlw es un tipo de fuente, 
El tipo de fuente se lo puede crear

 ejemplos
                       
PFont font;  
font = loadFont("Ziggurat-32.vlw");  
textFont(font);  
fill(0);
text("UTE", 0, 40);  
text("JAVA", 0, 70);  
text("PROG", 0, 100);  

PFont font;
font = loadFont("Ziggurat-32.vlw");
textFont(font);
fill(255);  
text("UTE", 0, 40);
fill(0);  
text("JAVA", 0, 70);
fill(102);  
text("PROG", 0, 100);




rotate(parámetro); scale(parámetro);

La función  rotate() sus  parámetros están en unidades de radianes.
Una forma puede rotar 360 grados


Los valores de mouseX pueden ser convertidos a valores de 0.0 to 2π,
 

La función  map( ) es usada para hacer esta conversión y el resultado de ese valor es usado por la función rotate(). Así  map(value, start1, stop1, start2, stop2)

rotate(PI/8);
smooth();
rect(55, 0, 30, 45);
rotate(PI/8);
rect(55, 0, 30, 45);


CUADRO DE ROTACIONES, Según el ángulo PI




REALIZAR LA SIGUIENTE ACTIVIDAD





CLIC AQUÍ PARA LEER MÁS

miércoles, 4 de diciembre de 2013

0
18 Realizar y Digitar los ejercicios de la página anterior




Realizar y Digitar los ejercicios de la página anterior

CLIC AQUÍ PARA LEER MÁS

martes, 3 de diciembre de 2013

0
17 ejercicios






A)
color ruby = color(211, 24, 24, 160);
color pink = color(237, 159, 176);
background(pink);
noStroke();
fill(ruby);
rect(35, 0, 20, 100);
B)
size(100, 100);
ellipse(width*0.5, height*0.5, width*0.66, height*0.66);
line(width*0.5, 0, width*0.5, height);
line(0, height*0.5, width, height*0.5);
C)
background(56, 90, 94);
smooth();
int x = 0;
strokeWeight(12);
for (int i = 51; i <= 255; i += 51) {
  stroke(242, 204, 47, i);
  line(x, 20, x+20, 80);
  x += 20;
}
D)
triangle(55, 9, 110, 100, 85, 100);
triangle(55, 9, 85, 100, 75, 100);
triangle(-1, 46, 16, 34, -7, 100);
triangle(16, 34, -7, 100, 40, 100);
E)
fill(0);
rect(0, 40, 100, 20);
fill(255, 51);  
rect(0, 20, 33, 60);
fill(255, 127);  
rect(33, 20, 33, 60);
fill(255, 204);  
rect(66, 20, 33, 60);
F)
rect(20, 15, 20, 70);
noStroke();  
rect(50, 15, 20, 70);
rect(80, 15, 20, 70);
G)
size(100, 100);
ellipse(width*0.5, height*0.5, width*0.66, height*0.66);
line(width*0.5, 0, width*0.5, height);
line(0, height*0.5, width, height*0.5);
H)
colorMode(HSB);
for (int i = 0; i < 100; i++) {
  stroke(132, i*2.5, 204);
  line(i, 0, i, 100);
}
I)
colorMode(HSB);
for (int i = 0; i < 100; i++) {
  stroke(132, 108, i*2.5);
  line(i, 0, i, 100);
}
J)
fill(0, 76);
noStroke();
smooth();
for (int y = -10; y <= 100; y += 10) {
  for (int x = -10; x <= 100; x += 10) {
    ellipse(x + y/8.0, y + x/8.0, 15 + x/2, 10);
  }
}
K)
noStroke();
fill(0);
beginShape();
vertex(40, 10);
for (int i = 20; i <= 100; i += 5) {
  vertex(20, i);
  vertex(30, i);
}
vertex(40, 100);
endShape();
L) RECORTAR EL GRÁFICO ute.jpg
PImage img;
img = loadImage("ute.jpg");
tint(102); // tonalidad Tint gray
image(img, 0, 0);
noTint();  
image(img, 50, 0);
M)
PImage img;
img = loadImage("ute.jpg");
tint(0, 153, 204); // tonalidad Tint azul
image(img, 0, 0);
noTint();  
image(img, 50, 0);
N)
color yellow = color(220, 214, 41);
color green = color(110, 164, 32);
color tan = color(180, 17, 132);
PImage img;
img = loadImage("ute.jpg");
tint(yellow);
image(img, 0, 0);
tint(green);
image(img, 33, 0);
tint(tan);
image(img, 66, 0);
O)
PImage img;
img = loadImage("ute.jpg");
background(255);
tint(255, 102);  
image(img, 0, 0, 100, 100);
tint(255, 204, 0, 153);    
image(img, 20, 20, 100, 100);
P)
PImage img;
img = loadImage("ute.jpg");
background(255);
tint(255, 51);
// Dibuja la imagen 10 veces, moviéndose a la derecha
for (int i = 0; i < 10; i++) {
  image(img, i*10, 0);
}
Q)
size(700, 100);
noStroke();
fill(0);
float angle = 0.0;
for (int x = 0; x <= width; x += 5) {
  float y = 50 + (sin(angle) * 35.0);
  rect(x, y, 2, 4);
  angle += PI/40.0;
}
R)
smooth();
noFill();
randomSeed(0);
strokeWeight(10);
stroke(0, 150);
for (int i = 0; i < 160; i += 10) {
  float inicio = radians(i);
  float fin = inicio + HALF_PI;
  arc(67, 37, i, i, inicio, fin);
}
S)
smooth();
noFill();
randomSeed(0);
strokeWeight(10);
stroke(0, 150);
for (int i = 0; i < 160; i += 10) {
  float inicio = radians(i);
  float fin = inicio + HALF_PI;
  arc(67, 37, i, i, inicio, fin);
}
T)
noStroke();
smooth();
float radio = 1.0;
for (int grado = 0; grado < 360*6; grado += 11) {
  float angulo = radians(grado);
  float x = 75 + (cos(angulo) * radio);
  float y = 42 + (sin(angulo) * radio);
  ellipse(x, y, 6, 6);
  radio = radio + 0.34;
}
U)
smooth();
strokeWeight(10);
stroke(0, 130);
line(0, random(100), 100, random(100));
line(0, random(100), 100, random(100));
line(0, random(100), 100, random(100));
line(0, random(100), 100, random(100));
line(0, random(100), 100, random(100));
V)
smooth();
strokeWeight(20);
stroke(0, 230);
float r = random(5, 45);
stroke(r * 5.6, 230);
line(0, r, 100, random(55, 95));
r = random(5, 45);
stroke(r * 5.6, 230);
line(0, r, 100, random(55, 95));
r = random(5, 45);
stroke(r * 5.6, 230);
line(0, r, 100, random(55, 95));
W)
size(100, 100);
translate(width/2, height/2);
line(-width/2, 0, width/2, 0);  
line(0, -height/2, 0, height/2);  
smooth();
noStroke();
fill(255, 204);
ellipse(0, 0, 45, 45);  
ellipse(-width/2, height/2, 45, 45);
ellipse(width/2, -height/2, 45, 45);
X)
void setup() {
  size(100, 100);
  noStroke();
  smooth();
}
void draw() {
  fill(255);
  ellipse(50, 50, 60, 60);  
  fill(0);
  ellipse(50+10, 50, 30, 30);  
  fill(255);
  ellipse(50+16, 45, 6, 6);  
}
Y)
void setup() {
  size(100, 100);
  noStroke();
  smooth();
}
void draw() {
  fill(255);
  ellipse(50, 50, 60, 60);  
  fill(0);
  ellipse(50+10, 50, 30, 30);  
}
Z)
void setup() {
  size(100, 100);
}
void draw() {
  for (int i = 0; i < 50; i += 2) {
    point(mouseX+i, mouseY+i);
  }
}





CLIC AQUÍ PARA LEER MÁS