Processing
Enviado por hdjsdfhkfsdhl • 21 de Abril de 2022 • Trabajo • 473 Palabras (2 Páginas) • 55 Visitas
Si queremos cambiar el color de la línea utilizaremos la función:
stroke (R,G,B);
NEGRO (0,0,0)
Podemos el cambiar el color de la línea y relleno de las figuras.
fill(); // define el relleno
stroke(); // define el trazo
Podemos manejar sólo valores de gris, desde el negro hasta el blanco:
fill(0); // negro
fill(255); // blanco
fill(127); // gris (cualquier valor desde 1 a 254)
[pic 1]
USAR fill(#FFFF33) o elq sea
Si queremos cambiar el grosor de la línea utilizaremos la función:
strokeWeight (x);
Abre Processing y escribe:
size (400,400); // tamaño pantalla
background (200); // color de fondo gris claro
stroke(255,0,0);//define el color de la linea, en este caso rojo
strokeWeight (10);//define el grosor de las lineas
line (0,200,400,200);//linea horizontal
line (200,0,200,400);// linea vertical
Abre Processing y escribe:
size (400,400); // tamaño pantalla
background (200); // color de fondo gris claro
stroke(255,0,0);//define el color de la linea, en este caso rojo
strokeWeight (10);//define el grosor de las lineas
line (0,200,400,200);//linea horizontal
line (200,0,200,400);// linea vertical
BUCLES
Size (600,600)
Int x= 20
Stroke
PUNTOS
For (dnd empieza;y hasta dnd, d cnt en cnt quiero ir avanzando)
For(int i=20;i<80;i=i+5){
Line(20,i,80,i+15); }
ELIPSE/CIRCULO
//ejemplo circunferencia
size (200,200); //tamaño ventana
ellipse (100,100,75,75);//circunferencia
/ejemplo elipse
size (200,200); //tamaño ventana
stroke (255,0,0); //color borde rojo
strokeWeight (5); //grosor 5
noFill (); // sin relleno
ellipse (100,100,100,50);//elipse
TRIANGULO
triangle(x1,y1,x2,y2,x3,y3)
CUADRADO
Rect(x1,y1,ancho,largo)
3 PASOS FUNDAMENTALES PARA CARGAR UNA IMAGEN EN PROCESSING
-guardamos foto en data
-función foto en processing: PImage + de inventas variable (p.e “foto”)
PImage photo;
Void setup () {
size (400,400); //tiene q coincidir cn el tamaño d la imagen, sino se corta
photo = loadImage (“vean.jpg”); //haybq poner exactamente el nombre de la foto con q la guardamos
}
Void draw () {
image(photo,0,0);
}
BUCLES Y COSAS
DIANA DE COLORES
size (1000,1000);
for (int i=0; i<=600; i+=60){
if (i<600) { fill (255,255,0);}//amarillo.
if (i<480) { fill (255,0,0);}//rojo. 600-120 son 480 y así sucesivamente.
if (i<360) { fill (0,0,255);}//Azul
if (i<240) { fill (0,0,0);}//Negro
if (i<120) { fill (255,255,255);}// BLanco
circle (300,300,600-i);
}
...