miércoles, 8 de septiembre de 2010

repaso de códigos



ellipse(40, 80, 90, 60); // línea izq
ellipse(20, 50, 40, 60);
ellipse(30, 90, 50, 60); // línea medio
ellipse(40, 50, 50, 60);
ellipse(50, 80, 90, 60); // línea der



background(0); // setea negro en background
stroke(255); // setea valores bco en líneas
strokeWeight(5); // setea ancho líneas 5 pixeles
smooth(); // suaviza bordes
ellipse(20, 90, 30, 40); // línea izq
ellipse(30, 80, 40, 40);
ellipse(40, 70, 50, 40); // línea medio
ellipse(50, 90, 60, 40);
ellipse(60, 80, 70, 40); // línea der
*

int x = 0; // setea posición horizontal
int y = 55; // setea posición vertical
void setup() {size(100, 100); // Setea la ventana de 100 x 100 pixeles
}
void draw() {
background(204);
ellipse(x, y, x+80, y-40); // línea izq
ellipse(x+20, y, x+60, y-50); // línea mitad
ellipse(x+10, y, x+30, y-50); // línea der
x = x + 1; // Suma 1 a xif (x > 100) { // Si x es mayor que 100,
x = -40; // asigna 40
}
}
*
void setup() {
size(200, 200);
noLoop();
}
void draw() {
diagonals(40, 90);
diagonals(60, 62);
diagonals(20, 40);
}
void diagonals(int x, int y) {
ellipse(y, x, x+20, y-40);
ellipse(x+20, y, x+50, y-40);
ellipse(x+40, y, x+60, y-40);
}
*
Diagonals da, db;
void setup() {
size(200, 200);
smooth();
// Inputs: x, y, velocidad, espesor, grray
da = new Diagonals(0, 90, 1, 6, 0);
db = new Diagonals(0, 55, 4, 3, 255);
}
void draw() {
background(204);
da.update();
db.update();
}
class Diagonals {
int x, y, speed, thick, gray;
Diagonals(int xpos, int ypos, int s, int t, int g) {
x = xpos;
y = ypos;
speed = s;
thick = t;gray = g;
}
void update() {
strokeWeight(thick);
stroke(gray);
ellipse(y, x, x+60, y-80);
ellipse(y+10, x, x+40, y-50);
ellipse(y+20, x, y+40, x-40);
x = x + speed;
if (x > 100) {x = -100;
}
}
}

No hay comentarios:

Publicar un comentario