• Editor
  • Animate Texture Offset & Scale

Hey there!

Is there a way i can do texture clipping (not sure if this is the correct term) in spine?
E.g. i want to animate a life-bar from 100% to 0% without scaling the texture content but clipping it.

Programmatically i'm used to achieve this by animating the sprite scale as well as the texture scale and/or offset accordingly.

Is somebody doing this in spine with a different approach (maybe some custom variables i can animate and use within my runtime) or are there any plans for animating textures offset & scale?

Thanks in advance!
Celt

Related Discussions
...

(Speaking unofficially) This isn't part of Spine. It'd be an interesting feature though.
But this does require certain flexibility/functionality on the game engine/runtime side.

But if it's for a runtime that supports meshes and manual UV mapping, and Spine draws parts by generating meshes and assigning UV coordinates, it could theoretically be done by moving the vertices AND the UV coordinates at the same time (I could be wrong though. I'm not too familiar with how UV coordinate data gets pushed to the GPU.).

The other way to achieve the health bar functionality is to use a cutoff shader and an additional texture that determines the mask and it'd have nothing to do with Spine. But it would give you more options for the shape of this bar. This would also depend on the flexibility of your engine.

But right now, judging from the Trello boards and kickstarter feature list, it's neither an existing nor a planned feature.

It might be implemented along with FFD. It's just like storing vertices for FFD, but UVs instead. Applying the data is almost identical as well. It is useful for some neat tricks, such as a pseudo 3D effect when adjusting the texture of a deformed mesh. Hard to explain, but the mesh is bending the image, so if you adjust the UVs then the part of the image that is bent changes.

Spine will limit UVs to the source image bounds because it is expected that images are packed in an atlas. This means you'll need to pad images with whitespace if you need UVs outside the cropped image bounds, and also that you can't use whitespace trimming.

Thanks for the answers!

The way both of you suppose is indeed what i had in mind. I'm really looking forward for the FFD functionalities; until than i will handle it programmatically.