Hi, Im in a mess with the draw function. I thought it was a loop that dont finish each step till all the instruction are finished, but it seems to me that it doesnt work like that, because I´ve tried to put a lot of instructions in it and the program don´t draw instruction by instruction but it show a clear window, after a while a few drawins and after another while all the drawing complete.
This is the program
Code:void Linea(float x, float y, float longitud,float angulo,float yema,float incrementoangulo,float veces){
float finalx=x+longitud*cos(angulo);
float finaly=y+longitud*sin(angulo);
float nuevox=x+longitud*cos(angulo)*yema;
float nuevoy=y+longitud*sin(angulo)*yema;;
float nuevalongitud;
float nuevoangulo;
delay(5);
line(x,y,finalx,finaly);
nuevalongitud=longitud*0.7;
if (veces>0){
Linea(nuevox,nuevoy,nuevalongitud,angulo+incrementoangulo,yema,incrementoangulo,veces-1);
Linea(nuevox,nuevoy,nuevalongitud,angulo-incrementoangulo,yema,-incrementoangulo,veces-1);
}
}
void setup(){
size(1000, 1000);
background(255);
}
void draw(){
background(255);
Linea (500,700,200,-PI/2,1,PI/5,6);
}