Background color change
              in 
             Programming Questions 
              •  
              1 years ago    
            
 
            
            this is my first post.
I'm starting to use processig and I'm in love.
I'm in a difficulty. I want to change the background color when you move your mouse and let the trail of the ellipse on the screen.
I can change the background color when you move the mouse but can not leave the trail of the ellipse, can someone help me?
float x,y;
float easing = 0.01;
float diameter = 12;
void setup() {
size(254, 254);
smooth();
noStroke();
}
void draw() {
float bkg = dist(127,127,mouseX,mouseY);
background(bkg*2);
float targetX = mouseX;
x += (targetX - x) * easing;
float targetY = mouseY;
y += (targetY - y) * easing;
ellipse(x, y, diameter, diameter);
if(mousePressed){
fill(148,255,113);
}else{
fill(252,43,75);
}
}
 
           
 
            
           I'm starting to use processig and I'm in love.
I'm in a difficulty. I want to change the background color when you move your mouse and let the trail of the ellipse on the screen.
I can change the background color when you move the mouse but can not leave the trail of the ellipse, can someone help me?
float x,y;
float easing = 0.01;
float diameter = 12;
void setup() {
size(254, 254);
smooth();
noStroke();
}
void draw() {
float bkg = dist(127,127,mouseX,mouseY);
background(bkg*2);
float targetX = mouseX;
x += (targetX - x) * easing;
float targetY = mouseY;
y += (targetY - y) * easing;
ellipse(x, y, diameter, diameter);
if(mousePressed){
fill(148,255,113);
}else{
fill(252,43,75);
}
}
 
              
              1  
            
 
            
 
 
          