fade out problem
in
Programming Questions
•
4 months ago
Hi!
I want to create a drawing patch where the lines from the tale fades away partly. so if im drawing with ellipses I want the most recent drawn ellipses to be in alpha 0 and then slowly fade away but not completely. so you can se whats have been drawn. so I want the drawing to stay in alpha say 180
in the patch below the whole tale fades and not the individual ellipses
so:
most recent drawn ellipses start in alpha 0 and fade against 180 while the new ellipses does the same procedure.
heres my example code: (tried to do this with PGraphics to create a second layer but without success)
any tips?
I want to create a drawing patch where the lines from the tale fades away partly. so if im drawing with ellipses I want the most recent drawn ellipses to be in alpha 0 and then slowly fade away but not completely. so you can se whats have been drawn. so I want the drawing to stay in alpha say 180
in the patch below the whole tale fades and not the individual ellipses
so:
most recent drawn ellipses start in alpha 0 and fade against 180 while the new ellipses does the same procedure.
heres my example code: (tried to do this with PGraphics to create a second layer but without success)
any tips?
- int a = 0;
- PGraphics pg;
- void setup() {
- size(400, 400);
- smooth();
- pg = createGraphics (400, 400);
- }
- void draw() {
- pg.beginDraw(); // startar renderingen
- pg.fill(0, 255, 0);
- pg.stroke(255, 0, 0);
- pg.ellipse(mouseX, mouseY, 10, 10);
- pg.endDraw(); // avslutar renderingen
- image(pg, 10, 10);
- a=a+1;
- noStroke();
- fill(255, a);
- rect(0, 0, 400, 400);
- // restart
- if (a == 180) {
- a = 0;
- }
- println(a);
- }
1