Transparent canvas in HTML5 target

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
493
Hello everyone!

I was just experimenting a bit and I wanted to have a transparent canvas. Turns out it is possible:
When the webgl context is requested, CX - per default - doesn't request the alpha channel. Presumably due to performance reasons. You'll find this in
targets/html5/modules/native/html5game.js
in
function BBHtml5Game( canvas ){
there's
Code:
var attrs={ alpha:false };

That's the culprit. I think it would be cool to have this configurable via app config, e.g. HTML5_CANVAS_ALPHA, which would default to false (for compatibility and - if what MDN says about using alpha and performance is true - performance).

What do you think?
 

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
493
This would allow to overlay arbitrary HTML with a canvas. E.g. for graphical effects

canvas-overlay2.gif
 

wick

Member
3rd Party Module Dev
Tutorial Author
Patreon Bronze
Joined
Jul 17, 2017
Messages
76
Oh that is neat! I don't think I'd end up using it, but I could see it being useful for some wacky experiments.
 
Top Bottom