Closed JMedina90 closed 1 year ago
In the PIXI application creation phase, set the attribute resizeTo
to window
and view
to HTMLCanvasElement
, after which you just need to adjust the position of the canvas in the window and keep it centered.
If you need to resize the model according to the screen, you can listen to the window.resize
event or a custom media query event, and then just set the scale property of the model to scale
it, for example:
const xs = window.matchMedia('screen and (max-width: 768px)');
xs.addEventListener('change', (e) => {
if (e.matches) model.scale.set(0.1);
});
In the PIXI application creation phase, set the attribute
resizeTo
towindow
andview
toHTMLCanvasElement
, after which you just need to adjust the position of the canvas in the window and keep it centered.If you need to resize the model according to the screen, you can listen to the
window.resize
event or a custom media query event, and then just set the scale property of the model toscale
it, for example:const xs = window.matchMedia('screen and (max-width: 768px)'); xs.addEventListener('change', (e) => { if (e.matches) model.scale.set(0.1); });
This is what I was looking for. Thank you!
Is this possible? Also, is it possible to adjust the model to the size of the screen?
Thanks