# Struggling to create a gradient

**URL:** <https://discourse.processing.org/t/struggling-to-create-a-gradient/33355>\
**Category:** Libraries\
**Created:** [November 6, 2021, 4:29am UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355 "2021-11-06T04:29:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcabc](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bcabc](https://discourse.processing.org/u/bcabc)\
**Post date:** [November 6, 2021, 4:29am UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355/1 "2021-11-06T04:29:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [November 6, 2021, 7:49pm UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355/2 "2021-11-06T19:49:41Z")

</div>

Hi!

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

> <https://github.com/micycle1/PeasyGradients/blob/master/src/peasyGradients/Test.java>

---

<div class="post-metadata">

**Author:** ![bcabc](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bcabc](https://discourse.processing.org/u/bcabc)\
**Post date:** [November 7, 2021, 11:55am UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355/3 "2021-11-07T11:55:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [November 7, 2021, 3:49pm UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355/4 "2021-11-07T15:49:37Z")

</div>

Maybe @micycle could say more about that? 🙂

---

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [November 7, 2021, 7:07pm UTC](https://discourse.processing.org/t/struggling-to-create-a-gradient/33355/5 "2021-11-07T19:07:41Z")

</div>

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.

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

> **[Release 0.9.1 · micycle1/PeasyGradients](https://github.com/micycle1/PeasyGradients/releases/tag/0.9.1)**
>
> Install like so:

Use masking (as [described](https://github.com/micycle1/PeasyGradients#masking) 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:

```auto
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));
  gradient.primeAnimation();
}

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 🙂 ).
