Why background('rgba(0,255,0, 0.25)') inoperative?

hello i us background(‘rgba(0,255,0, 0.25)’) in my code,but the Alpha inoperative?
the browser is chrome (107.0.5304.88)

background(‘rgba(0,255,0, 0.25)’);
1667186860737

I tested your code in Firefox and Chrome (version 107.0.5304.88 as well), and the alpha is displaying properly. Did you remember to refresh your web page after saving your sketch?

Perhaps you have a typo somewhere. Just to make sure that isn’t the issue try it with this code:

function setup() {
  createCanvas(100, 100, WEBGL);
}

function draw() {
  background('rgba(0, 255, 0, 0.25)');
  rotateY(millis() / 1000);
  noFill();
  stroke(255, 204, 0);
  strokeWeight(1);
  sphere(40);
}

You could also check the Console in Chrome and see if it mentions any errors. To open your console:

  1. Right mouse click on the web page where your sketch is shown
  2. Press Inspect
  3. Press the Console tab somewhere in the top
2 Likes