0 votes

Hye evetone,
Is it possible with a shader to decompose an image into several pieces and then animate them with tween?

Good day,

Godot version V 3.4.3
in Engine by (86 points)

Animating with tween is not a valid idea, but perhaps You could animate it all using shader ? What Do You want to happen with partialized image ?

1 Answer

+3 votes

I'm no shader expert, but I don't think your request is possible - at least the animate them with a tween part. However, you could dynamically create a set of new images that are each some smaller portion of an original source image. Then, those new images could be assigned to some appropriate node (maybe a Sprite) which could then be animated via a tween.

The main thing you'd need is the ability to create a new image from a piece of an original image. That's what the Image.blit_rect(...) function does.

https://docs.godotengine.org/en/stable/classes/class_image.html?highlight=image#class-image-method-blit-rect

So, you'd basically need to:

  • Loop over the original image and extract small pieces into new Image objects via blit_rect().
  • Assign each image to an appropriate node for animation (Sprite for instance)
  • Build a tween to animate the resulting nodes as necessary
by (19,268 points)

Thank you, I will try. But you get lost pretty quickly with the concepts of Texture, Imagre, TextureImage.

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 Frequently asked questions and 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 [email protected] with your username.