Catalina Angulo: tarea 6
De Casiopea
Título | Catalina Angulo: tarea 6 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 6 |
Asignatura | Imagen Escrita 2012, |
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) | Catalina Angulo |
Profesor | Herbert Spencer |
Elemento[] cosas; int count; Elemento especial; void setup() { cosas = new Elemento[10]; count = 0; size(700, 700); background(0); especial = new Elemento(width/4, height/3); especial.c = color(#5734A2,10); especial.d = 0; especial.velx = 1; especial.vely = 3; especial.edadMax = 95; } void draw() { for (int i = 2; i < count; i++) { cosas[i].existe(); } especial.existe(); } void mousePressed() { cosas[count] = new Elemento(mouseX, mouseY); cosas[count].velx = mouseX - pmouseY; cosas[count].vely = mouseX - pmouseY; count ++; } void keyPressed() { cosas[count] = new Elemento(); cosas[count].velx = mouseX - pmouseY; cosas[count].vely = mouseX - pmouseY; 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(200, 10, 224, 30); velx = vely = 0; edadMax = round(random(100, 200)); edad = 0; d = random(-4, 70); } Elemento() { x = random(width); y = random(height); c = color(200,201,224,30); velx = vely = 3; edadMax = round(random(90, 150)); edad = 0; d = random(2, -2); } void dibuja() { noStroke(); fill(c); ellipse(x, x, x, x); edad ++; d -= 3; } void actualizaPosicion() { x += velx; y += vely; } void revisaSiRebota() { if ((x < d/2) || (x > width - (d/2))) { velx *= -1; vely += random(-1, 1); } if ((y < d/2) || (y > height - (d/2))) { vely *= 0; velx += random(0, 5); } } void existe() { if (edad < edadMax) { dibuja(); actualizaPosicion(); revisaSiRebota(); } } }