There are several approaches to this problem. Some include:
- draw many tiny arc segments to create a gradient (solution from @Ov3rM1nD above)
- create a closed PShape in the shape of an arc and fill with a gradient (e.g. a PShader)
- draw a full gradient image, then draw a single arc as a mask and apply to “cut-out” your gradient.
For examples and past discussion of the mask-based approach, see:
- https://forum.processing.org/two/discussion/20005/2d-gui-libraries
- https://forum.processing.org/two/discussion/18818/how-to-draw-a-transparent-pgraphics-image-solved
- https://forum.processing.org/two/discussion/23886/masking-a-shape-with-another-shape
There is also a related library: