I'm trying to use hexadecimal values for colors in p5.js and I'm having trouble using it and using an alpha at the same time. I'd like to set the color with one variable and the alpha with another.
let myColor = '#FF0000';
let myAlpha = 128;
function setup() {
createCanvas(200,200);
}
function draw() {
fill(color(myColor), myAlpha);
noStroke();
ellipse(100, 100, 50, 50);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.js"></script>
<html>
<head></head>
<body></body>
</html>
This works for the color, but the alpha ends up being 255 (100%).