Count up and down elegantly
c++, logic, math
Solution
How about using a sin function, that way the fading is more pleasant and you'll get what you want.
Problem
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?