MAKIO135 / svg5.js

A tiny JS library to generate static SVGs for plotters, lasercutting, embroidery and more, based on Processing/p5js syntax.
MIT License
138 stars 8 forks source link

add defs and method to create linear gradients #21

Closed TengilLejonhjarta closed 1 year ago

TengilLejonhjarta commented 3 years ago

Something I tend to use a lot with SVG is defs for filters and gradients, would something like this be interesting to add to svg5?

Usage something like this

createSVG(500, 500)
let g1 = createLinearGradient(0, 0, 1, 1, [{offset: 0, color: "red"}, {offset: 100, color: "orange"}])
background(`url(#${g1})`)
render()
MAKIO135 commented 3 years ago

Nice addition. Could you do this PR with the dev branch instead of the master? I'll handle it from there

TengilLejonhjarta commented 3 years ago

There we go @MAKIO135! Had some issues with the rebase but a squash and merge should clean that up. Only my additions now, pointing to your dev branch 👍