Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Sprite


Sprites are like little images that live inside of other images. These images are the texture images of Materials. Sprites reference materials.

If you are creating a flipbook animation, it is easier to animate all of the frames inside of a single image texture file. But how would the framework know where exactly are each of the frames located in the image? It would know it because you created a sprite, which contains the positions of each frame inside the larger texture image.

What does is inside a frame



This is how these different metrics look like.

Offset X and Offset Y

Offsets in pixels, from the top-left corner. This is the pixel coordinate position of the top-left corner of the sprite and where it starts.

Width and Height

Width and height of the frame, in pixels.

Midpoint X and Midpoint Y

Offsets of the midpoint of the frame, in pixels. It is relative to the frame offset. Usually they will be set to half of the width and half of the height, so that the midpoint is in the midpoint of the sprite.

Border H and V

Horizontal and vertical borders around the sprite, in pixels. Only used for text rendering.