Subscribe - pvm

2-

void setup(){
  size(400,400);
  frameRate(20);
}

void draw(){
  int i;
  for(i=0;i<height;i++){
    if(random(0,1)<0.5) stroke(0);
    else stroke(255);
    line(0,i,width,i);
  }
}

3-

void desenhaIFSP(float x, float y){

noStroke();
fill(255,0,0);
ellipse(60+x,40+y,56,56);
fill(0,130,0);
rect(32+x,70+y,55,55,5);
rect(32+x,128+y,55,55,5);
rect(32+x,186+y,55,55,5);

rect(90+x,12+y,55,55,5);
rect(90+x,70+y,55,55,5);
rect(90+x,128+y,55,55,5);
rect(90+x,186+y,55,55,5);


rect(148+x,128+y,55,55,5);
rect(148+x,12+y,55,55,5);
}

float x,y;
float dx,dy;

void setup(){
  
  size(800,600);
  x=0;
  y=0;
  dx=3;
  dy=3;
}


void draw(){
 
  background(255);
  desenhaIFSP(x,y);
  x+=dx;
  y+=dy;
  
  if(x>width-203 || x<-32) dx=-dx;
  if(y>height -242 || y<-12) dy=-dy;  
}

4-

int c,d;

void desenhaIFSP(int c){
noStroke();
fill(c,0,0);
ellipse(60,40,56,56);

fill(0,c,0);
rect(32,70,55,55,5);
rect(32,128,55,55,5);
rect(32,186,55,55,5);

rect(90,12,55,55,5);
rect(90,70,55,55,5);
rect(90,128,55,55,5);
rect(90,186,55,55,5);

rect(148,128,55,55,5);
rect(148,12,55,55,5);
}

void setup(){
  size(256,256);
  c=80;
  d=1;
}

void draw(){
  background(255);
  desenhaIFSP(c);
  c+=d;
  if(c>255||c<80)d=-d;
}
1 Like

use to </> to add your code is easier to read. like below. And try to make as simple as you can. It’s eaier to see where is the problem for you and for the people read it.
Because here we don’t know what you want, where is the problem…

void setup(){
 size(400,400);
 frameRate(20);
}

void draw() {
 int i;
 for(i=0;i<height;i++){
   if(random(0,1)<0.5) stroke(0);
   else stroke(255);
   line(0,i,width,i);
 }
}
void desenhaIFSP(float x, float y){
  noStroke();
  fill(255,0,0);
  ellipse(60+x,40+y,56,56);
  fill(0,130,0);
  rect(32+x,70+y,55,55,5);
  rect(32+x,128+y,55,55,5);
  rect(32+x,186+y,55,55,5);

  rect(90+x,12+y,55,55,5);
  rect(90+x,70+y,55,55,5);
  rect(90+x,128+y,55,55,5);
  rect(90+x,186+y,55,55,5);

  rect(148+x,128+y,55,55,5);
  rect(148+x,12+y,55,55,5);
}
float x,y;
float dx,dy;

void setup(){
  size(800,600);
  x=0;
  y=0;
  dx=3;
  dy=3;
}

void draw(){
  background(255);
  desenhaIFSP(x,y);
  x+=dx;
  y+=dy;

  if(x>width-203 || x<-32) dx=-dx;
  if(y>height -242 || y<-12) dy=-dy;
}

// 4-

int c,d;

void desenhaIFSP(int c){
  noStroke();
  fill(c,0,0);
  ellipse(60,40,56,56);

  fill(0,c,0);
  rect(32,70,55,55,5);
  rect(32,128,55,55,5);
  rect(32,186,55,55,5);

  rect(90,12,55,55,5);
  rect(90,70,55,55,5);
  rect(90,128,55,55,5);
  rect(90,186,55,55,5);

  rect(148,128,55,55,5);
  rect(148,12,55,55,5);
}
int c,d;
void setup(){
  size(256,256);
  c=80;
  d=1;
}

void draw(){
  background(255);
  desenhaIFSP©;
  c+=d;
  if(c>255||c<80)d=-d;
}
1 Like

@Solsticio – what does “Subscribe - pvm” mean?

What is your question? What do you want to happen, and what is happening instead?