Quick question about RenderingServer and animations

Godot Version 4.6.3

Hello! Just made an account for the forums, and am relatively new to the workings of Godot myself.

Was reading up on RenderingServer and was wondering, since sprites and such could be heavily optimised with it, how animations might do the same.

I know canvas_item_add_animation_slice exists but it seems pretty clunky and doesn’t have nearly as many features as AnimatedSprite2D/AnimationPlayer.

I’m surprised RenderingServer has anything to help animations past canvas_item_add_texture_rect_region

If you want helpful features then you should use the higher level functions in AnimatedSprite2D and AnimationPlayer

okay cool, thanks for the info : )

kinda a shame RenderingServer has so little when it comes to moving pictures

It’s intended to be minimal, and if you are using a lower level feature then animating by srcRect is pretty standard; those who have used SDL or Raylib before will be very familiar.

It doesn’t take too much work to get a properly formatted spritesheet animated with the equation

var src: Rect2i

src.size.x = frame_width
src.size.y = frame_height

var frame_x: int = current_frame % h_frames
var frame_y: int = current_frame / h_frames

src.position.x = frame_width * frame_x
src.position.y = frame_height * frame_y

which may be similar to what add_animation_slice does. Anything more complicated (such as an ill-formatted spritesheet) opens a can of worms for low-level code that is much better handled in the high-level with GUIs and such.