Gradient interpolation with 3+ points

Great that you got it working! :slight_smile:

btw. you can edit your post to make the int a float with the little pen icon.

And I would say if you use the pixels array it would be faster than with rect. pixels[] / Reference / Processing.org

Even faster would be to use GLSL shaders but that’s a whole different language and not ideal if you don’t know it already. The reason it would be faster is because it would calculate the pixel colors in parallel instead of sequentially. Also only important if you want to do it animated in real time. If the goal is to save an image it doesn’t matter that much.

Cheers!