0 votes

I would like the ability to dynamically stretch a sprite for a certain amount along both the X and Y axes, by specific amounts or percentages. So for example, I might stretch a sprite's width to 120% of its default width, but I would stretch its height to 200%. Then, in the next iteration of the game loop, I might stretch that particular sprite's height only to 190%, or maybe 210%, depending on certain circumstances.

Is that possible currently in Godot?

in Engine by (12 points)

1 Answer

+2 votes

IMO this is a simple scaling.

For example:

var sprite = get_node("path/to/sprite/node")
var scale = sprite.get_scale()

scale.x = scale.x*1.2
scale.y = scale.y*2

sprite.set_scale(scale)
by (673 points)

Does this scaling work well with anti-aliasing present in the existing sprite?

I don't know, try it :)!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.