Sprite.js and Font.js

Hello, are there any ways to change sprite size and font size ?

As you can see, I can change width and height of the sprite to change the scale of it. But how can I change the font size which has no width and height properties?

I tried to modify maxResHeight and it worked! However, the postion of the font was changed, too. As

Is there any good way to scale the sprite and the fontzise ? Like fontsize: 100%

Thank you for your time!

Hello,

These scripts are not really meant to resize scripts or fonts. Rather you create your sprite and font and use it as is so it’s mostly pixel perfect. The maxResHeight property is there so that you define your maximum target resolution (which also depends on the resolution settings you’ve set for the project) and then the UI scales accordingly to accommodate that resolution height. But if you have a different project resolution than the one you define in maxResHeight then things might indeed not look right.

We have some new 2D components in the works that will allow you to do all the things you want. These are still in development but they are coming soon…

1 Like

Thank you so much, valos. It’s nice to hear that there are some new 2D components coming.

In my project, I want to change the font’s scale when clicking them as a feedback to users. I’m looking forward to the new 2D components.:grinning:

any update regarding these components?

Our new UI related components are currently in beta testing - they should be released soon after the holidays hopefully.

That’s great! I’m working on my first game with play canvas and those components will be very useful.