# P5JS coding using PORTRAIT

**URL:** <https://discourse.processing.org/t/p5js-coding-using-portrait/39373>\
**Category:** Coding Questions\
**Created:** [October 20, 2022, 3:47pm UTC](https://discourse.processing.org/t/p5js-coding-using-portrait/39373 "2022-10-20T15:47:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaBoyez](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@DaBoyez](https://discourse.processing.org/u/DaBoyez)\
**Post date:** [October 20, 2022, 3:47pm UTC](https://discourse.processing.org/t/p5js-coding-using-portrait/39373/1 "2022-10-20T15:47:01Z")

</div>

I’m trying to create a mobile game (one accessible on the internet), and am trying to code in a portrait orientation lock, so one can turn a device on its side and the screen remains the same instead of trying to awkwardly flip.

I can redefine the window using deviceOrientation but I don’t know how I can lock the portrait orientation.

Any ideas?

Thank you

---

<div class="post-metadata">

**Author:** ![vkbr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/vkbr/32/16844_2.png) [@vkbr](https://discourse.processing.org/u/vkbr)\
**Post date:** [October 20, 2022, 6:05pm UTC](https://discourse.processing.org/t/p5js-coding-using-portrait/39373/2 "2022-10-20T18:05:13Z")

</div>

Hello and welcome, could you be more specific? If, as you say, you can redefine the window is it not just redefine it with the wanted aspect ratio? Maybe, if you can, show your attempt, may be easier to understand.
