Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » (mod) Scratch 3 16:9
- JGames101
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
I made this because I was reading https://scratch.mit.edu/discuss/topic/326148/ and I was interested how easy/difficult it would be to change the aspect ratio/resolution in Scratch 3. Unlike infinitytec's planned mod, this does not have the ability to dynamically change aspect ratio.
Turns out, it required modifying three files:
SCRATCH-GUI - src/lib/layout-constants.js: I changed the default export's height from 360 to 270.
To get fullscreen to work, src/lib/screen-utils.js: in the function getStageDimensions, on line 62, in small browsers, it finds the stage height in fullscreen by multiplying the width by .75. Change .75 to .5625 for 16:9 or anything else for a custom ratio, and on line 58, it finds the width for all other browsers. Change line 58 to however you'd like to obtain the width. Here's what I did:
SCRATCH-VM - src/engine/runtime.js: I changed the method GET_HEIGHT to return 270 instead of 360. This one isn't absolutely necessary, but it will make blocks like if on edge work properly with the new resolution.
SCRATCH-RENDER - src/RenderWebGL.js: I changed the constructor's default resolution. There is info about the constructor above for documentation, which would be good to update, but the only line you need to change is:
(I changed 170 and -170 to 135 and -135)


You can try it at https://thejamesbm.github.io/scratch-16-9/
Note that the GitHub repo only has the scratch-gui code, because the changes to scratch-vm and scratch-render were so small they weren't worth the effort of creating more github repos and uploading the full scratch-vm and scratch-renders there.
Turns out, it required modifying three files:
SCRATCH-GUI - src/lib/layout-constants.js: I changed the default export's height from 360 to 270.
To get fullscreen to work, src/lib/screen-utils.js: in the function getStageDimensions, on line 62, in small browsers, it finds the stage height in fullscreen by multiplying the width by .75. Change .75 to .5625 for 16:9 or anything else for a custom ratio, and on line 58, it finds the width for all other browsers. Change line 58 to however you'd like to obtain the width. Here's what I did:
stageDimensions.width = stageDimensions.height + Math.round(stageDimensions.height / 1.28571429);
SCRATCH-VM - src/engine/runtime.js: I changed the method GET_HEIGHT to return 270 instead of 360. This one isn't absolutely necessary, but it will make blocks like if on edge work properly with the new resolution.
SCRATCH-RENDER - src/RenderWebGL.js: I changed the constructor's default resolution. There is info about the constructor above for documentation, which would be good to update, but the only line you need to change is:
this.setStageSize(xLeft || -240, xRight || 240, yBottom || -135, yTop || 135);


You can try it at https://thejamesbm.github.io/scratch-16-9/
Note that the GitHub repo only has the scratch-gui code, because the changes to scratch-vm and scratch-render were so small they weren't worth the effort of creating more github repos and uploading the full scratch-vm and scratch-renders there.
Last edited by JGames101 (Dec. 31, 2018 17:37:48)
- LuckyLucky7
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
When I looked at your post from this topic, I was looking if there was a link for your screenshot for a mod. And then, I just see this new topic.
Last edited by LuckyLucky7 (Dec. 31, 2018 17:20:24)
- LuckyLucky7
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
Also, I found 2 bugs: Scratch cat looks a little bit weird and when you go into fullscreen, it is not 16:9. I'll edit this post later with screenshots.
- JGames101
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
Also, I found 2 bugs: Scratch cat looks a little bit weird and when you go into fullscreen, it is not 16:9. I'll edit this post later with screenshots.I actually just fixed fullscreen, refresh your page

Last edited by JGames101 (Dec. 31, 2018 17:34:38)
- LuckyLucky7
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
Now fix the Scratch Cat sprite:Also, I found 2 bugs: Scratch cat looks a little bit weird and when you go into fullscreen, it is not 16:9. I'll edit this post later with screenshots.I actually just fixed fullscreen, refresh your page
Mod:Also, make sure that the mod is updating correctly, because:
Scratch 3 Beta:

Last edited by LuckyLucky7 (Dec. 31, 2018 17:39:54)
- JGames101
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
Now fix the Scratch Cat sprite:Also, I found 2 bugs: Scratch cat looks a little bit weird and when you go into fullscreen, it is not 16:9. I'll edit this post later with screenshots.I actually just fixed fullscreen, refresh your page
Also, make sure that the mod is updating correctly, because:
Weird, the update worked fine for me. Try refreshing again, or closing and reopening the tab?
Scratch cat looks different because they updated the sprite, you can see it at https://llk.github.io/scratch-gui/develop, but that hasn't been added to the beta version yet.
Last edited by JGames101 (Dec. 31, 2018 17:58:42)
- LuckyLucky7
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
Now it worksNow fix the Scratch Cat sprite:Also, I found 2 bugs: Scratch cat looks a little bit weird and when you go into fullscreen, it is not 16:9. I'll edit this post later with screenshots.I actually just fixed fullscreen, refresh your page
Also, make sure that the mod is updating correctly, because:
Weird, the update worked fine for me. Try refreshing again, or closing and reopening the tab?
Scratch cat looks different because they updated the sprite, you can see it at https://llk.github.io/scratch-gui/develop, but that hasn't been added to the beta version yet.

- LuckyLucky7
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
Removed
Last edited by LuckyLucky7 (Jan. 3, 2019 23:50:54)
- NxNmultiply
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
I find it pointless because it's only more awkward than 480×360. It would've made much more sense to make it customizable from 1×1 to 640×480.
- infinitytec
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
I find it pointless because it's only more awkward than 480×360. It would've made much more sense to make it customizable from 1×1 to 640×480.The point of this is to give it a 16:9 aspect ratio, which matches the aspect ratio of most modern desktop monitors. I think a better resolution to do would be 1920x1080 or 1280x720, but of course both of those are possible with vector graphics.
- NxNmultiply
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
But that is very awkward for making actual projects. What's the point of matching aspect ratio? And if it's done by changing the resolution, then why not instead make it customizable so that a mod user can pick the most convenient one?I find it pointless because it's only more awkward than 480×360. It would've made much more sense to make it customizable from 1×1 to 640×480.The point of this is to give it a 16:9 aspect ratio, which matches the aspect ratio of most modern desktop monitors. I think a better resolution to do would be 1920x1080 or 1280x720, but of course both of those are possible with vector graphics.
- Spongebobhi
-
Scratcher
5 posts
(mod) Scratch 3 16:9
the github link for the mod doen't exist. new link please!!!
- 4wngregus1
-
Scratcher
100+ posts
(mod) Scratch 3 16:9
it does not work it gives me a github 404 error
maybe it was deleted
maybe it was deleted- mybearworld
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
(#15)Yes, the user deleted their github account.
it does not work it gives me a github 404 errormaybe it was deleted
- Communicaty
-
Scratcher
14 posts
(mod) Scratch 3 16:9
shoot(#15)Yes, the user deleted their github account.
it does not work it gives me a github 404 errormaybe it was deleted
Last edited by Communicaty (April 22, 2022 04:55:20)
- Communicaty
-
Scratcher
14 posts
(mod) Scratch 3 16:9
thanksthe github link for the mod doen't exist. new link please!!!Apparently the GitHub account it was on was deleted, so maybe try this mod instead.
- Noed666Man4
-
Scratcher
5 posts
(mod) Scratch 3 16:9
also used turbowarpthanksthe github link for the mod doen't exist. new link please!!!Apparently the GitHub account it was on was deleted, so maybe try this mod instead.
no 16:9
- dynamicsofscratch
-
Scratcher
1000+ posts
(mod) Scratch 3 16:9
update link to this? https://sheeptester.github.io/scratch-gui/?height=270
- Discussion Forums
- » Advanced Topics
-
» (mod) Scratch 3 16:9











maybe it was deleted
