miércoles, 27 de octubre de 2010

Avance examen

1. Referencia del collage de perfil






2.
// Bolita

float x = 0;
float y = 0;
float xspeed = 2.2;
float yspeed = 5.5;
float r = 50;

void setup() {
size(200,200);
smooth();

}

void draw() {
background(255);

// Add the current speed to the x location.
x = x - xspeed;
y = y + yspeed;

// Remember, || means "or."
if ((x > width) || (x < 0)) {
// If the object reaches either edge, multiply speed by -1 to turn it around.
xspeed = xspeed * -1;
r = 50;
}

// Remember, || means "or."
if ((y > height) || (y < 0)) {
// If the object reaches either edge, multiply speed by -1 to turn it around.
yspeed = yspeed * -1;
r = 50;
}

// Display circle at x location
noStroke();
fill (128,0,255);
ellipse(x,y,r,r);

r = constrain(r-2,32,64);

}

martes, 12 de octubre de 2010

intento fallido ejercicio modulo 6

PShape bot1;
PShape bot2;
PShape bot3;
PImage fondo;
float easing = 0.05;
float offset = 0;
void setup() {
size(600, 400);
bot1 = loadShape("cacaguate.svg");
bot2 = loadShape("cacaguate2.svg");
bot3 = loadShape("cacaguate3.svg");
fondo = loadImage("fonfon.png");
smooth();
}
void draw() {
// Set the background to the "landscape" image; this image
// must be the same width and height as the program
background(fondo);
// Set the left/right offset and apply easing to make
// the transition smooth
float targetOffset = map(mouseY, 0, height, -40, 60);
offset += (targetOffset - offset) * easing;
// Draw the left robot
shape(bot1, 85 + offset, 30);
// Draw the right robot smaller and give it a smaller offset
float smallerOffset = offset * 0.7;
shape(bot2, 510 + smallerOffset, 140, 45, 248);
// Draw the smallest robot, give it a smaller offset
smallerOffset *= -0.5;
shape(bot3, 410 + smallerOffset, 225, 39, 124);
}

capítulo 6





PFont font; //nombro la tipografia (paso 2)
PImage nana;
void setup() {
size(737, 500);
smooth();
font = loadFont("Bauhaus93-48.vlw"); //cargo la tipografia que estaba en DATA (paso3)
nana = loadImage("IMAGE.jpg");
textFont(font);//comienzo a usar la tipografia (paso4)
}
void draw() {
background (nana);

fill (0);
textSize(36);
text("black", 25, 350); //escribo
fill (250);
textSize(36);
text("whitee", 25, 390); //escribo
fill (199,236,87);
textSize(36);
text("be yourself", 300, 410); //escribo
textSize(36);
text("day by day", 400, 450); //escribo

}

martes, 5 de octubre de 2010

Power Point: Funciones

Cacaguate en movimiento

tuve un problema, lo logre mover pero todo se desparrama y nose como controlarlo. intenté de muchas formas pero no pude. Por eso quiero que me ayude mañana si es posible porfavor profe. gracias



int x = 150; // x-coordinate
int y = 420; // y-coordinate
int bodyHeight = 110; // Body Height
int neckHeight = 190; // Neck Height
int radius = 45; // Head Radius
int ny = y - bodyHeight - neckHeight - radius; // Neck Y
float easing = 0.02;
void setup () {
size (340,400);
smooth();
strokeWeight(2);
background(0);

ellipseMode(RADIUS);
}

void draw() {
int targetX = mouseX;
x += (targetX - x) * easing;
if (mousePressed) {
neckHeight = 86;
bodyHeight = 90;
} else {
neckHeight = 70;
bodyHeight = 160;
}
float ny = y - bodyHeight - neckHeight - radius;

// Head
fill(192,192,192);
ellipse(x+12, ny, radius+12, radius+12);
fill(204,51,200);
rect(x-4, bodyHeight-18, 30, bodyHeight-80);
fill(0,255,0); // ojos
ellipse(x+36, ny-6, 14, 14);
fill(0);
ellipse(x+30, ny-6, 3, 3);
fill(0,255,0);
ellipse(x-10, ny-6, 14, 14);
fill(0);
ellipse(x-4, ny-6, 3, 3);


// orejas
noStroke();
fill(133,102,255);
ellipse(x+12, ny, x-18, ny-43);
fill(64,0,128);
ellipse(x+12, ny, x+42, ny-99);

//legs
noStroke();
fill(78,78,78);
rect(x-10, y-bodyHeight, 20, bodyHeight-33);
fill(78,78,78);
rect(x+30, y-bodyHeight, 30, bodyHeight-33);
fill(78,78,78);
rect(x-60, y-bodyHeight, 30, bodyHeight-33);

// Body&arms
fill(142,145,240);
ellipse(x+10, ny+135, x-20, ny-77); // 160, ny+135, 130, ny-77
fill(128,255,128);
ellipse(x+12, ny+145, x-18, ny-77);
fill(225,157,215);
ellipse(x+14, ny+165, x-16, ny-77);
fill(0,128,192);
triangle(x-90, 320, 159, 100, 250, 320); // triangulo grande
fill (166,240,238);
triangle(x-45, 225, 159, 110, 207, 225);// triangulo chico




}