p5.patgrad
p5.patgrad copied to clipboard
awesome lib! could/should merge into p5 main repo??
Quick note to say how awesome this lib is! it solves an issue that regularly comes up when teaching– after demonstrating webgl + textures, someone always asks 'can i put a texture on a primitive in 2d?' = this! otherwise one has to use pgraphics, mask, etc etc.. gradients are also a common question.. this lib takes me back to the fun macdraw days with fill patterns that were ooooh so important.
i wonder if main p5 repo would consider embracing this (as it makes using images on fill, stroke that much more accessible and easy to implement for beginners):
-
fill()
+stroke()
would accept an image/pattern, which applies thisfillStyle
+strokeStyle
canvas mods (not sure how it could deal with an image vs a pattern.. gen on the fly?) -
background()
already accepts an image, but could also accept a pattern - main lib could be reduced to 3 main functions,
createPattern()
,createGradient()
- both with options ie angle, stops, etc
Of course one can just include this lib and then use away.. it just seems like the gen and display of this lib are things that could/should be built into p5.
PS - in both chrome and firefox, there was no problem using fillPattern()
within a push()
/pop()
as cautioned in the readme.. perhaps the only 'gotcha' for beginners is the need to translate()
first...
Thank you, really glad you like it!
I think p5 is only accepting new feature requests that expand access (https://github.com/processing/p5.js/tree/main/contributor_docs) and I'm not sure that this fits, but it might be worth checking to see if they've updated their policies...