So, I'm trying to create a radial gradient (for static lighting in a game). I came up with this:
int step = 4;
int forLen = (radius / step);
g.setColor(new Color(0, 0, 0, intensity));
for (int i = 0; i < forLen; i++)
g.fillOval(radius - i * step, radius - i * step, i * step * 2, i * step * 2);
But the result i get is this:
I'd like to get a smoother gradient, like:
I tried playing around with the step and the intensity, but i can't get something similar to the gradient above. What would be a good way of doing this?? Thanks in advance!