Sprite:set: Difference between revisions

From GiderosMobile
Rrraptor (talk | contribs)
formatting
Line 3: Line 3:
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
=== <translate>Description</translate> ===
=== <translate>Description</translate> ===
<translate><br />
Sets the specified property of this sprite instance by its name. These names are supported:
Sets the specified property of this sprite instance by its name. These names are supported:<br />
<ul>
<br />
<ul><br />
<li>''"x"''</li>
<li>''"x"''</li>
<li>''"y"''</li>
<li>''"y"''</li>
Line 25: Line 24:
<li>''"anchorY"''</li>
<li>''"anchorY"''</li>
<li>''"anchorZ"''</li>
<li>''"anchorZ"''</li>
</ul><br />
</ul>
<br /></translate>
<source lang="lua">
<source lang="lua">
Sprite:set(param,value)
Sprite:set(param,value)
</source>
</source>


Line 34: Line 32:
'''param''': (string) <translate>The name of the parameter</translate> <br/>
'''param''': (string) <translate>The name of the parameter</translate> <br/>
'''value''': (number) <translate>The new value of the specified parameter</translate> <br/>
'''value''': (number) <translate>The new value of the specified parameter</translate> <br/>
=== <translate>Examples</translate> ===
=== <translate>Examples</translate> ===
'''Example'''<br/>
<source lang="lua">
<source lang="lua">-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setX(10)
sprite:setX(10)
sprite:set("x", 10)
sprite:set("x", 10)
Line 58: Line 57:
-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setScale(0.5)
sprite:setScale(0.5)
sprite:set("scale", 0.5)</source>
sprite:set("scale", 0.5)
</source>


{{Sprite}}
{{Sprite}}

Revision as of 18:46, 28 February 2020


Available since: Gideros 2011.6
Class: Sprite

Description

Sets the specified property of this sprite instance by its name. These names are supported:

  • "x"
  • "y"
  • "z"
  • "rotation"
  • "rotationX"
  • "rotationY"
  • "scaleX"
  • "scaleY"
  • "scaleZ"
  • "alpha"
  • "redMultiplier"
  • "greenMultiplier"
  • "blueMultiplier"
  • "alphaMultiplier"
  • "anchorX"
  • "anchorY"
  • "anchorZ"
Sprite:set(param,value)

Parameters

param: (string) The name of the parameter
value: (number) The new value of the specified parameter

Examples

-- the following two lines do the same thing
sprite:setX(10)
sprite:set("x", 10)
		
-- the following two lines do the same thing
sprite:setY(10)
sprite:set("y", 10)

-- the following two lines do the same thing
sprite:setRotation(10)
sprite:set("rotation", 10)

-- the following two lines do the same thing
sprite:setScaleX(0.5)
sprite:set("scaleX", 0.5)

-- the following two lines do the same thing
sprite:setScaleY(0.5)
sprite:set("scaleY", 0.5)

-- the following two lines do the same thing
sprite:setScale(0.5)
sprite:set("scale", 0.5)