Ok, I have a control that want to fade in and out (continuously). In order to fade it I adjust the transparency value of the control in the drawing routine. So I set up a timer that runs and I adjust the m_transparency member. The timer runs and it should sweeps back and forth between the two defined values m_start, m_end. These can be 0-255.
eg. start 30, end 55, increment value = 5. It would look like:
30, 35, 40, 45, 55, 50, 45, 40, 35, 30, 35, 40 .......
should also handle start 55, end 30.
Anyways, I wrote a horrific function that basically tests every condition (am I moving up or down and have I reached the start, end, turn around point, etc). It is ugly and I'm embarrassed (triple nested ifs) but I can't figure out a cleaner way to do it then test everything. Is there an easier way?