Comments (2)
I looked into this, the reason this is happening is because alpha
is only used on the canvas when it is initialized. There are some performance implication by having alpha or not enabled on the canvas, for many browser opaque canvases are faster. Once options are set using canvas.getContext
, they cannot be changed. Here's a simple example: https://jsfiddle.net/bigtimebuddy/m9kehdqx/
Here are the initialization methods for each renderer if you'd like to see how it's being used.
Renderer
CanvasRenderer
The workaround is make sure you set alpha to be < 0 when you create the Application or Renderer.
One small suggestion we could make is if the canvas is opaque (because of how you initialized), we could provide a console warning when trying to change the alpha after the fact. Something like:
The canvas has already been initialized as non-transparent. If you'd like to adjust alpha of the canvas after initializing the renderer, please set the initial value less than 1.
Some documentation might also clarify this behavior.
from pixijs.
I have a same issue on my private project.
this.#pixiApp.renderer.background.color = "rgb(255,0,0)";
this.#pixiApp.renderer.background.alpha = 0.5;
background is applied without alpha.
Environment
- pixi.js version: 7.4.0
- Browser & Version: Ubuntu 22.04 Edge 121.0.2277.83 (Official build) (64-bit)
from pixijs.
Related Issues (20)
- [V8] Error with `new Sprite(null)` HOT 2
- Bug: v8.x Sprites not rendering in Chrome/Edge Windows 11 HOT 5
- Bug: [V8] Container.removeChildren performance issue HOT 2
- Bug: `loadTextures` ignores provided format HOT 4
- Feature Request: Put again sync methods in ExtractSystem
- Bug: requestVideoFrameCallback does not seem to be working as expected HOT 1
- Bug: v8.0.3+ addressMode is repeat by default HOT 1
- Feature Request: [v8] Support `breakWords: true` with Pixi.BitmapText HOT 4
- Bug: crash when WebGL2RenderingContext is not available HOT 8
- Feature Request: better tree-shaking HOT 5
- Feature Request: preventing loading / unloading systems HOT 2
- Bug: Assets.load for BitmapFonts broken ? HOT 4
- Bug: TexturePacker anchor point ignored HOT 3
- Bug: TypeError: Cannot read properties of null (reading 'structureDidChange') HOT 5
- Bug: ReferenceError: Can't find variable: WebGL2RenderingContext HOT 2
- Bug: TypeError: RendererClass is not a constructor HOT 3
- Bug: TypeError: Failed to execute 'shaderSource' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLShader' HOT 1
- Bug: RangeError: Failed to execute 'createBuffer' on 'GPUDevice': createBuffer failed, size is too large for the implementation when mappedAtCreation == true HOT 1
- Bug: TypeError: Cannot read properties of null (reading 'uid') HOT 1
- Bug: The content of multiple texts overlaps with each other. HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixijs.