Camila Saavedra: tarea 6
De Casiopea
Título | Camila Saavedra: tarea 6 |
---|---|
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) | Camila Saavedra |
Profesor | Herbert Spencer |
<nowiki> Elemento[] cosas; int count; Elemento especial; void setup() { cosas = new Elemento[20]; count = 0; size(800,700); background(#FFFFFF); especial = new Elemento(width/10, height/10); especial.c = color(300, 225); especial.d = 10; especial.velx = 10; especial.vely = 7 ; 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+50; cosas[count].vely = mouseX - pmouseY+100; count ++; } void keyPressed() { cosas[count] = new Elemento(); count ++; } class Elemento { float x, y; float d; color c; float velx, vely; int edadMax; int edad; Elemento(float posX, float posY) { x = posX; y = posY; c = color(#5904BC, #2E04BC, #1923CE, #197BCE); velx = vely = 0; edadMax = round(random(100, 10)); edad = 0; d = random(1, 70); } Elemento() { x = random(width); y = random(height); c = color(#04B404, 80, 115, 20); velx = vely = 0; edadMax = round(random(100, 200)); edad = 0; d = random(1, 30); } void dibuja() { noStroke(); fill(c); ellipse(x+2,y+3, 110, 110); 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(); } } }<nowiki>