We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I have a code for now that makes a colourful circle move around a black screen. What I want to happen is get the circle to fade once the mouse lets go, if you understand what I mean. The issue is I already have an alpha setting put in place to create the blurred edges of the circle, and most things I've found about fading animations include more alpha settings that I don't know how to add. I've also tried to create this code using P2D rendering but it doesn't work at all so I can't use that to save any graphics that are made, which is what I've found most people do with creating graphics. Here is the code so far:
float hue;
color c;
float xPos;
float yPos;void setup() {
size(1000, 1000);
background(0);
colorMode(HSB);
}
void draw() {
background(0);
boll();
}
void boll() {
xPos = mouseX - width/2;
yPos = -(mouseY - height/2);
hue = atan2(yPos, xPos);
hue = map(hue, -PI, PI, 0, 255);
c = color(hue, 255, 255);
if (mousePressed == true) {
for (int i = 0; i < 85; i++) {
int d = 1 + (i2);
int alpha = 255 - (i3);
noStroke();
fill(c, alpha);
ellipse(mouseX, mouseY, d, d);
}
}
}