Thanks glv!
your example helped me realize that after doing translate i had to start drawing my sine function at 0,0, as the translate is already placing the coordinates origin where you tell it…
I ended up, by the moment, with this:
void setup()
{
size(1920, 1080);
frameRate(1);
//noLoop();
}
void draw()
{
background(0);
noFill();
stroke(255);
for (int i=0; i<20; i++)
{
float x=random(width);
float y=random(height);
float w=50+random(width/2);
float h=random(10);
float len=random(0,1);
float ph=0;
pushMatrix();
translate(x,y);
rotate(-45+radians(random(90)));
sindraw(0,0,w,h,len,ph);
popMatrix();
}
}
void sindraw(float startx, float starty, float w, float h, float len, float ph){
beginShape();
for (float i = startx; i <=startx+w; i+=1) {
float j = starty + (sin(ph) * h);
vertex(i, j);
ph += len*(i/w);
}
endShape();
}
My intention with this is to go on improving this weird thing i have running 24h a day until the lockdown lasts (situation is kinda hard here in spain):
thanks, and hope you enjoy the stream!