Paul Guitard: Electrones
De Casiopea
Título | Tarea 6 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 6 |
Período | 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) | Paul Guitard |
Profesor | Herbert Spencer |
class Bounce { float x, y; float diameter; float speed; int direction = 1; int SCALE = 10; float s; Bounce(float xpos, float ypos, float dia, float sp){ x = xpos; y = ypos; diameter = dia; speed = sp; } void move(){ y += (speed * direction); if((y > (height - diameter/2)) || (y < diameter/2)){ direction *= -1; } } void move2(int newX, int newY) { x = newX; y = newY; } void display(){ ellipse(x, y, diameter, diameter); } void paint(){ fill(0, 1.5); rect(0, 0, width, height); if((y > (height - diameter/2)) || (y < diameter/2)){ fill(255); } else{ fill(255); } } } int numBoun = 10; Bounce boun[] = new Bounce[numBoun]; int grabbed = -1; void setup(){ size(400, 400); background(0); smooth(); noStroke(); for(int i=0; i < boun.length; i++){ float x = 20 + i*40; float rate = 0.5 + i*0.23; boun[i] = new Bounce(x, 50, 30, rate); } } void draw(){ for(int i=0; i < boun.length; i++){ boun[i].paint(); if (grabbed == i) { boun[i].x = mouseX; boun[i].y = mouseY; } else { boun[i].move(); } boun[i].display(); } stroke(255); for (int i=0; i < boun.length-1; i++) { for (int j=i+1; j < boun.length; j++) { if (dist(boun[i].x, boun[i].y, boun[j].x, boun[j].y) < 100) { line(boun[i].x, boun[i].y, boun[j].x, boun[j].y); } } } noStroke(); } void mousePressed() { for (int i=0; i < boun.length; i++) { if (dist(mouseX, mouseY, boun[i].x, boun[i].y) < 30) { grabbed = i; } } } void mouseReleased() { grabbed = -1; }