viernes, 29 de noviembre de 2013

0
16 Ejercicios


Ejercicio

 

Qué hace este código.



Digitar




A)


for (int x=-16; x<100; x+=10) {
  line(x, 0, x+15, 50);
}
strokeWeight(4);
for (int x=-8; x<100; x+=10) {
  line(x, 50, x+15, 100);
}

B)



smooth();
strokeWeight(12);
strokeCap(ROUND);
line(20, 30, 80, 30);  
strokeCap(SQUARE);
line(20, 50, 80, 50);    


C)

void setup() {
size(250,250);
}
void draw() {
colorMode(HSB);
for (int i = 0; i < 100; i++) {
  stroke(i*2.5, 255, 255);
  line(i, 0, i, 100);
}
}

D)

void setup() {
size(250,250);
}
void draw() {
for (int i=0; i<100; i+=2) {
  stroke(255-i);
  line(i, 0, i, 200);
}
}










E)

void setup() {
size(250,250);
}
void draw() {
noStroke();
for (int y=0; y<100; y+=10) {
  for (int x=0; x<100; x+=10) {
    fill((x+y) * 1.4);
    rect(x, y, 10, 10);
  }
}














 FIGURAS



triangle(X1, Y1, X2, Y2, X3, Y3);
triangle(60, 10, 25, 60, 75, 65); 
















Traslación

rect(0, 5, 70, 30);
translate(10, 30); // Se cambia a 10 pixels a la derecha y 30 hacia abajo
rect(0, 5, 70, 30);




beginShape();


vertex(X, Y);
 vertex(X1, Y1);
vertex(X2, Y2);
endShape(CLOSE);



beginShape(POINTS);
 


 EJEMPLO

noFill();
beginShape();
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();



IMAGEN


PImage img;

img = loadImage("arch.jpg");
image(img, 0, 0);


void setup(){
  background(255,0,0);
size(300,240);
}
void draw(){
PImage ldu, d;
ldu = loadImage("ldu.jpg");
image(ldu, 20,20);

}






 

 

 

 

 

 

 

 

 

 

 

0 comentarios: