Alexandra Staig: Tarea 6 Pizarra
De Casiopea
Título | Tarea 6 de Pizarra + Objeto |
---|---|
Palabras Clave | Tarea Pizarra 6 |
Período | 2012- |
Asignatura | Imagen Escrita 2012, |
Carreras | Arquitectura, 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) | Alexandra Staig |
Profesor | Herbert Spencer |
/* Se ocupa idea base del trabajo de Luciano Morales, haciendo cambios en el movimiento original del punto del mouse, el tamaño y el fondo. */
Elemento[] cosas; int count;
Elemento especial;
void setup() {
cosas = new Elemento[200]; count = 0; size(700, 700); background(255); especial = new Elemento(width/5, height/15); especial.c = color(#308BCE, #308BCE); especial.d = 20; especial.velx = 15; especial.vely = 100 ; especial.edadMax = 200;
}
void draw() {
for (int i = 0; i < count; i++) { cosas[i].existe(); } especial.existe();
}
void mousePressed() {
cosas[count] = new Elemento(mouseX, mouseY); cosas[count].velx = mouseX - pmouseX; cosas[count].vely = mouseX - pmouseY; count ++;
}
void keyPressed() {
cosas[count] = new Elemento(); count ++;
}
/*--------------------------------------------------------------*/
class Elemento {
float x, y; // posición float d; // diámtero color c; float velx, vely; // velocidad int edadMax; int edad; Elemento(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(16, 2); } Elemento() { x = random(width); y = random(height); c = color(#08298A, 100, 100, 20); velx = vely = 0; edadMax = round(random(100, 20)); edad = 0; d = random(2, 30); } void dibuja() { noStroke(); fill(c); ellipse(x,y, 50, 80); edad ++; d -= 50; } void actualizaPosicion() { x += velx; y += vely; } void revisaSiRebota() { if ((x < d/80) || (x > width - (d/80))) { velx *= -1; vely += random(-1, 1); } if ((y < d/30) || (y > height - (d/30))) { vely *= -1; velx += random(-5, 5); } } void existe() { if (edad < edadMax) { dibuja(); actualizaPosicion(); revisaSiRebota(); } }
}