jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.29k stars 454 forks source link

Scene origin bottom left #609

Closed simonhoss closed 2 years ago

simonhoss commented 2 years ago

Hey

Thanks a lot for this library.

Is it possible to move the origin of a scene to bottom left?

Thanks for your help Simon

jonobr1 commented 2 years ago

Yes:

two.bind('resize', resize);
resize();
function resize() {
  two.scene.position.y = two.height;
}

Or if you're not using the fullscreen parameter when instantiating Two. You can do:

window.addEventListener('resize', resize, false);
resize();
function resize() {
  two.scene.position.y = two.height;
}
simonhoss commented 2 years ago

Thanks a lot! This works.

I made a pen for this: https://codepen.io/simonhoss/pen/oNoEjbO