Sebastián González tarea 7
De Casiopea
Título | Sebastián González - tarea 7 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 7, processing |
Período | 2012-2012 |
Asignatura | Taller Inicial Común 1ª y 2ª Etapa |
Del Curso | Imagen Escrita 2012 |
Carreras | Diseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property. |
Alumno(s) | Sebastián González |
Profesor | Herbert Spencer |
M[] cosas; int count;
M H;
void setup()
{
cosas = new M[200]; count = 0; size(500, 500); background(#80FF00); H = new M(width/10, height/10); H.c = color(#DF3A01, #00FFFF); H.d = 20; H.velx = 10; H.vely = 50; H.edadMax = 200;
}
void draw()
{
for (int i = 0; i < count; i++) { cosas[i].existe(); } H.existe();
}
void mousePressed() {
cosas[count] = new M(mouseX, mouseY); cosas[count].velx = mouseX - pmouseX; cosas[count].vely = mouseX - pmouseY; count ++;
}
void keyPressed() {
cosas[count] = new M(); count ++;
}
/*--------------------------------------------------------------*/
class M
{
float x, y; // posición float d; // diámetro color c; float velx, vely; int edadMax; int edad; M(float posX, float posY)
{
x = posX; y = posY; c = color(#08298A, #084B8A, #DF7401, #B40404); velx = vely = 0; edadMax = round(random(300, 10)); edad = 0; d = random(5, 2); } M() { x = random(width); y = random(height); c = color(#04B404, 100, 100, 20); velx = vely = 0; edadMax = round(random(100, 200)); edad = 0; d = random(2, 30); } void dibuja() { noStroke(); fill(c); ellipse(x,y, 20, 10); edad ++; d -= 50; } void actualizaPosicion() { x += velx; y += vely; } void revisaSiRebota() { if ((x < d/50) || (x > width - (d/50))) { velx *= -1; vely += random(-1, 1); } if ((y < d/70) || (y > height - (d/70))) { vely *= -1; velx += random(-1, 1); } } void existe() { if (edad < edadMax) { dibuja(); actualizaPosicion(); revisaSiRebota(); saveFrame ( "sdfsdf.jpg"); } }
}