how to achieve phasing fx?
in
Programming Questions
•
1 year ago
hi! here two rectangles blink in sync, but i want them to drift in and out of sync to make phase fx
my idea was to set up second counter n2+=1.005 but this failed because then (n2%7==1) is never true
any ideas how to achieve this?
// phase
float n=0;
void setup(){
size(500,400);
frameRate(10);
}
void draw(){
background(255);
fill(50,200,40);
rectMode(CORNER);
if (n%7==1){
rect(0,0,100,100);
}
if (n%7==1){
rect(400,0,100,100);
}
n+=1;
}
my idea was to set up second counter n2+=1.005 but this failed because then (n2%7==1) is never true
any ideas how to achieve this?
// phase
float n=0;
void setup(){
size(500,400);
frameRate(10);
}
void draw(){
background(255);
fill(50,200,40);
rectMode(CORNER);
if (n%7==1){
rect(0,0,100,100);
}
if (n%7==1){
rect(400,0,100,100);
}
n+=1;
}
1