object:useFrameForAnchors()

Type [Function][ap i.type.Function]
Object [SpriteObje ct]api.type.SpriteObject
Library [display.* ]api.library.display
Return value none
Revision [Release 2024.3703](https://solar2d.com/download/)
Keywords sprite, u seFrameForAnchors, anchor
See also [display. newSprite()]api.library.display.newSprite

Overview

Sets a frame in the currently loaded sequence as the reference for anchor points. Anchor point calculations will be performed as if this was the current frame, even when another is actually being displayed. Without this, sequences with variable-sized frames (possibly with trimming) can jump around during scaling and rotation, due to the anchor point resolving to a different position.

Syntax

object:useFrameForAnchors( [frameIndex] )

frameIndex (optional)

Number. The frame index in the currently loaded sequence you want to use as reference. The default is the current frame, or 1 is none has been set. In a sprite sequence, 1 indicates the first frame (not 0).