Hi guy i am trying to clone colol wheel picker from adobe color wheel, i am having a problem with changing the alpha for the color wheel, the code i used to generate the color wheel is referenced from here.Below is the code i use to change the alpha for the background of the canvas(default alpha is 255), but it's not working, i still can't figure out why
useEffect(() => {
const canvas = canvasRef.current;
const ctx = canvas.getContext("2d");
let ImageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
for (var i = 0; i < canvas.height; i++)
for (var j = 0; j < canvas.width; j++)
if ((i + 1) % 4 === 0) {
ImageData.data[i] = 150;
}
ctx.putImageData(ImageData, 0, 0); //put image data back
}, []);
you can find full code and demo in here, thank you
