I've got a simple .PNG image, with a white shape and a transparent background. This is being created in .js.
var img = document.createElement("img");
img.src = "Images/seed.png";
img.classList.add("seed");
document.getElementById("spiralDiv").appendChild(img);
I would like to add a linear gradient to this shape, changing the opacity of the shape. I have tried using the normal background: linear-gradient(rgba ...
method, but this gives the transparent background of the image a linear gradient as well, and I just want the gradient to apply to the shape only. Perhaps using a mask will help?
Change color of PNG image via CSS? was helpful to change just the color of the shape, but I am not sure how to get it working with a gradient.
I can't just draw the shape with a gradient in the photoshop, as I would also like to alter the direction of the gradient within the javascript at runtime.
Seed image with black background
(Sorry can't post images yet)