Hi
I want to change html body background-image with loaded images.
Any idea how to do this?
Hi
I want to change html body background-image with loaded images.
Any idea how to do this?
document.body.style.backgroundImage = `url(${URL})`;
How to replace ${URL} to loaded phaser texture/image.
I can get blob url using this.textures.get('bg').getSourceImage().src;
but its not working
In preload()
:
this.load.on('load', function (file) {
if (file.key === KEY) {
document.body.style.backgroundImage = `url(${file.src})`;
}
});
What if not from preload? i mean from a different scene.
i want to get the image from game scene.
I don’t think Phaser saves the load URL, you would have to save it yourself.
Thanks for your help, i will try it.