Pixi.js: Transparent background

Created on 29 Mar 2013  ·  11Comments  ·  Source: pixijs/pixi.js

Hi,

is there a way to have a transparent background?

thanks!

Most helpful comment

@zur4ik - I was having the same problem. For anyone else:

var renderer = PIXI.autoDetectRenderer(256, 256, {antialias: false, transparent: true, resolution: 1});

All 11 comments

Ah yes! That would be quite handy, pixi.js is not set up for transparent backgrounds just yet, but will be super easy to change that :)
Added to my todo list..

thanks for the reply, can you give me a hint please, maybe i could help ;)

You are more than welcome too help :+1:

Here's a starting point for ya :)

The background color is set here (line 78) in the canvas render:

if(this.view.style.backgroundColor!=stage.backgroundColorString)this.view.style.backgroundColor = stage.backgroundColorString;

and here (line 189) in the webGLRender:

gl.clearColor(stage.backgroundColorSplit[0], stage.backgroundColorSplit[1], stage.backgroundColorSplit[2], 1.0);

better late than never! background transparency is now implemented..

var renderer = PIXI.autoDetectRenderer(400, 300, null, *true*);

@GoodBoyDigital This is great! I was literally just looking to implement this. Thanks!

wow! ... was reserving my weekends to do this but thanks!!

and... for those new to pixi.js... wow! sweet!

I put

var renderer = PIXI.autoDetectRenderer(400, 300, null, true);

but my canvas is black anyway. Any ideas?

@zur4ik if you are using v3,that is not the proper param for autoDetectRenderer. Check out the v3 docs:

http://pixijs.github.io/docs/PIXI.html#.autoDetectRenderer

@zur4ik - I was having the same problem. For anyone else:

var renderer = PIXI.autoDetectRenderer(256, 256, {antialias: false, transparent: true, resolution: 1});

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaccob picture gaccob  ·  3Comments

zcr1 picture zcr1  ·  3Comments

Darker picture Darker  ·  3Comments

sntiagomoreno picture sntiagomoreno  ·  3Comments

softshape picture softshape  ·  3Comments