We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello, im having trouble with this code, i would really appreciate it if someone can help me :D this is the code
import processing.pdf.*; //importar la liberria para trabajar con pdf
boolean imprimir;
color c;
float a,e,i,o;
void setup() {
>
size(500, 500);//tamaño de canvas
a=(#F293F7);
e=(#56E1F2);
i=(#84E54C);
o=(#FF8F17);
}
void draw() {
if (imprimir==true) {
beginRecord(PDF, "fotos.pdf");//iniciar la creacion del archivo
}
background(mouseX, 115, 300); // varía color del fondo
for (int x=0; x<500; x+=60) { //posicion circulos
for (int y=0; y<500; y+=40) {
circulos(c, x, y, 5);//llamado de funciones
square(233, x, y);
}
}
//float a=(#F293F7);
//float e=(#56E1F2);
//float i=(#84E54C);
//float o=(#FF8F17);
c= color(a, e, i, o);
noFill();
strokeWeight(5);
triangle(400, 350, 100, 350, 250, 150); //triangulo más grande
strokeWeight(3);
triangle(325, 250, 250, 350, 175, 250);
triangle(400, 350, 213, 300, 250, 250);
triangle(288, 300, 100, 350, 250, 250);
triangle(287, 300, 213, 300, 250, 150);
if (imprimir==true) {
endRecord();//cerrar el archivo
imprimir=false;
}
}
void circulos(color c, float x, float y, float t) { //funcion del circulo
fill(c);
ellipse(x+20, y, t, t);
}
void square ( color c, float x1, float x2) { //funcion del cuadrado
noFill(); //sin relleno
strokeWeight (1);// grosor linea
rect( x1-40, x2-40, 60, 80);//cuadrados
}
void keyPressed() {
if (key=='a') {
fill( random(255));
}
else if (key=='e') {
color (#56E1F2);
} else if (key=='i') {
color (#84E54C);
} else if (key=='o') {
color (#FF8F17);
}
imprimir=true;
}
Answers
How to post in the processing forum.
You can edit your post (click the small gear and the 'Edit').
How to format Code:
empty line before and after the code section
select (highlight) entire code with the mouse
hit ctrl-o OR click the small C in the command bar
it's ok like that?
much better ;-)
Line 37:
circulos(color(random(255)), x, y, 5);//llamado de funciones
Please check more in the reference:
https://processing.org/reference/fill_.html
https://processing.org/reference/color_.html
Kf
LInes 99 to 114
Seen together with line 50:
You need to set a, e etc. In keyPressed to be used in line 50