How to access Offset of SpriteFrame in Animation?

Since the Animation editor does not support offsets as a property, I’ve been trying to write some code to retrieve the information from the spriteFrame offsets located at the picture shown below. But I’m stuck on how to access the .getOffset() function?

Capture2

This is my code to attempt to retrieve it but there are errors of null

Hi,You should write code like this to get the offset correctly:

anim.getComponent(cc.Sprite).spriteFrame.getOffset();

Ah! That managed to get me the offset, thank you. However, I’m still struggling with managing various kinds of sprite animations with different offsets. Sometimes the weapon extends below the feet and this pushes the whole sprite up.

I’m using TexturePacker that exports spritesheets and .plist file to Cocos format, but it seems as though I’m doing things very inefficiently as I still have to resort to manually moving pixel by pixel the animations I need to align with the Player node