I'm trying to make a flashing object, i.e., increment it's alpha value from 0 to 255 (gradually) and then back down to 0, and repeat.
Is there a way I can do this without using some boolean? Getting it to increment is easy:
alpha = time.elapsed()%256;
But what's a nice way to get it to count back down again after that?
How about using a sin function, that way the fading is more pleasant and you'll get what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With