Sprite does not support scaling, so I achieved it by changing the width and height. However, I found that when I zoom in, I scale based on the center. I want it to scale based on the bottom, but I don’t want to increase it. It looks like it’s a change based on the bottom. Is there a way to achieve bottom based scaling
I think you’ll have to calculate and assign a new position as well.
- const oldHeight = tree.height;
- tree.height = newHeight;
- position.y += (tree.height - oldHeight)/2
or alternatively
- position.y -= tree.height/2;
- tree.height = newHeight;
- position.y += tree.height/2;
3 Likes