I’m a programmer having a Math issue. I’m building an animation based on coordinate system. Now I’m painting my animation and want to make a soft color transition. I want my color to be darker at the bottom and lighter at the top. To set the color it, I use this formula:
color = (y/3000, y/4000, y/10000, 0.3)
This is RGBA format. The first value in brackets is red, the second one is green, the third one is blue and the forth is alpha. Let’s pay attention to red only.
At the very bottom of my animation, Y value is 1000, and at the top of it, Y value is 100. When I divide 1000 by 3000 at the bottom, I get 0,33 of red, that is a light red. When I divide 100 by 3000 at the top, I get 0,03 of red, that is a dark red. I need it to be vice versa: 0,03 at the bottom (dark red) and 0,33 of red at the top (light red). I’ve tried to change the formula I’m using, but it didn’t work for me. Is there any chance to make it work? I need to point out that the formula must include Y value, because it’s the only way to make the color transition really smooth.
I’ll be very grateful for any responses!