Difference between revisions of "Bitmap:setAnchorPoint"

From GiderosMobile
m (formatting)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
=== Description ===
 
=== Description ===
Sets the anchor point of [[Bitmap]] object.
+
Sets the anchor point of a '''Bitmap''' object.
 +
<syntaxhighlight lang="lua">
 +
Bitmap:setAnchorPoint(x,y)
 +
</syntaxhighlight>
  
Each [[Bitmap]] object has an anchor point that affects the positioning of the texture displayed. By modifying the anchor point, you change the origin of the texture. For example, setting the anchor point to (0.5, 0.5) moves the center of the texture to the origin. If you set the anchor point to (1, 1) instead, the bottom-right corner of the texture will be the origin. The default value of anchor point is (0, 0) which means top-left of the texture is the origin by default.
+
Each '''Bitmap''' object has an anchor point that affects the positioning of the texture displayed. By modifying the anchor point, you change the origin of the texture. For example, setting the anchor point to (0.5, 0.5) moves the center of the texture to the origin. If you set the anchor point to (1, 1) instead, the bottom-right corner of the texture will be the origin. The default value of anchor point is (0, 0) which means top-left of the texture is the origin by default.
<source lang="lua">
 
Bitmap:setAnchorPoint(x,y)
 
</source>
 
  
 
=== Parameters ===
 
=== Parameters ===
'''x''': (number) The x coordinate of anchor point. Usually between [0, 1].<br/>
+
'''x''': (number) the x coordinate of anchor point, usually between [0, 1]<br/>
'''y''': (number) The y coordinate of anchor point. Usually between [0, 1].<br/>
+
'''y''': (number) the y coordinate of anchor point, usually between [0, 1]<br/>
  
 
{{Bitmap}}
 
{{Bitmap}}

Latest revision as of 15:27, 13 July 2023

Available since: Gideros 2011.6
Class: Bitmap

Description

Sets the anchor point of a Bitmap object.

Bitmap:setAnchorPoint(x,y)

Each Bitmap object has an anchor point that affects the positioning of the texture displayed. By modifying the anchor point, you change the origin of the texture. For example, setting the anchor point to (0.5, 0.5) moves the center of the texture to the origin. If you set the anchor point to (1, 1) instead, the bottom-right corner of the texture will be the origin. The default value of anchor point is (0, 0) which means top-left of the texture is the origin by default.

Parameters

x: (number) the x coordinate of anchor point, usually between [0, 1]
y: (number) the y coordinate of anchor point, usually between [0, 1]