Struggling to create a gradient

hi there -

i am looking to include gradients in my processing drawings. i am generating svg images, so i believe the P2D renderer isn’t for me.
i’d also like to apply the gradients to large shapes made out of bezier curves - many of the examples i’ve seen seem to be linear.

i have tried to download the peasygradients library, but i seem to be doing something wrong. the only jar file that i can find on the peasygradients github is for jafama and it doesn’t seem to allow me to import anything related to peasygradients.

does anyone have any suggestions or examples of something like this? is it even possible?

thanks again!


Maybe the imports from this test file help you with using peasyGradients?

Still not much lucky. Is it possible that peasyGradients is not compatible with 4.0?

Maybe @micycle could say more about that? :slight_smile:

The project has been sitting at ~90% complete for about a year – I haven’t yet finished it off fully, nor have created a .jar for it.

Anyway, I’ve just created a proper .jar for so you are able to use it in the meantime:

Use masking (as described in the repo README) to apply a gradient to a shape. For now you’ll find general docs in the javadocs accompanying the source code – I’ll soon have these published as a Github pages website.

And some code to get you started:

import micycle.peasygradients.*;
import micycle.peasygradients.gradient.Gradient;

PeasyGradients pg;
Gradient gradient;

void setup() {
  size(800, 800);
  pg = new PeasyGradients(this);
  gradient = new Gradient(color(9, 101, 133), color(071, 244, 218), color(11, 167, 228), color(238, 85, 23), color(112, 12, 25));

void draw() {
  pg.spiralGradient(gradient, new PVector(width / 2, height/2), frameCount*0.05, 3);

Also, it’s better practice to raise such an issue on the Issues section of the Github repository (or at least tag me here :slight_smile: ).

1 Like