Search code examples
androidandroid-studiocanvasondrawfading

Fading out a shape. I have to use factory pattern to make Shapes Circle and rect


I have to use factory pattern to make Shapes Circle and rect . SO i made a button that called rect and circ and when i click it makes a circle or rect, but the issue is that I have to make it fading out everything i make a new circle the old one is to fade with each new one made out until its completely invisibly and popped off but i dont know how to do it or start. I was told to traverse vector and subtract alpha of them android. "As new shapes are added, the previously drawn shapes fade away.


Solution

  • While I think I understand you're issue, correct me if I don't.

    From what it sounds like, you might want to add an animation listener to your animation. The docs can be found here

    Specifically, you'll want to look at the onAnimationEnd callback. You can use that to start a new animation/create new shape/do whatever once a fade-out animation is complete