Difference between revisions of "Sprite:setAnchorPosition"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
m
 
(One intermediate revision by one other user not shown)
Line 7: Line 7:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
Sprite:setAnchorPosition(anchorX,anchorY,anchorZ)
 
Sprite:setAnchorPosition(anchorX,anchorY,anchorZ)
</source>
+
</syntaxhighlight>
  
 
Meaning '''Sprite''' with dimensions 100x100 and anchor position of 50x50 would rotate around its center.
 
Meaning '''Sprite''' with dimensions 100x100 and anchor position of 50x50 would rotate around its center.
Line 17: Line 17:
  
 
=== Note ===
 
=== Note ===
'''setAnchorPoint''' is available in the Bitmap class: [[Bitmap:setAnchorPoint]]
+
To manipulate individual anchors you can use '''[[Sprite:set]]'''.
  
 
{{Sprite}}
 
{{Sprite}}

Latest revision as of 17:28, 11 May 2025

Available since: Gideros 2015.03.22
Class: Sprite

Description

Sets x, y, z anchor position of Sprite in its relative coordinates.

Sprite:setAnchorPosition(anchorX,anchorY,anchorZ)

Meaning Sprite with dimensions 100x100 and anchor position of 50x50 would rotate around its center.

Parameters

anchorX: (number) anchor position in Sprite internal coordinates
anchorY: (number) anchor position in Sprite internal coordinates
anchorZ: (number) anchor position in Sprite internal coordinates optional

Note

To manipulate individual anchors you can use Sprite:set.