Difference between revisions of "Sprite:set"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
<br />
+
<translate><br />
 
Sets the specified property of this sprite instance by its name. These names are supported:<br />
 
Sets the specified property of this sprite instance by its name. These names are supported:<br />
 
<br />
 
<br />
 
<ul><br />
 
<ul><br />
<li>`"x"`</li><br />
+
<li>[[["x"]]]</li><br />
<li>`"y"`</li><br />
+
<li>[[["y"]]]</li><br />
<li>`"z"`</li><br />
+
<li>[[["z"]]]</li><br />
<li>`"rotation"`</li><br />
+
<li>[[["rotation"]]]</li><br />
<li>`"rotationX"`</li><br />
+
<li>[[["rotationX"]]]</li><br />
<li>`"rotationY"`</li><br />
+
<li>[[["rotationY"]]]</li><br />
<li>`"scaleX"`</li><br />
+
<li>[[["scaleX"]]]</li><br />
<li>`"scaleY"`</li><br />
+
<li>[[["scaleY"]]]</li><br />
<li>`"scaleZ"`</li><br />
+
<li>[[["scaleZ"]]]</li><br />
<li>`"alpha"`</li><br />
+
<li>[[["alpha"]]]</li><br />
<li>`"redMultiplier"`</li><br />
+
<li>[[["redMultiplier"]]]</li><br />
<li>`"greenMultiplier"`</li><br />
+
<li>[[["greenMultiplier"]]]</li><br />
<li>`"blueMultiplier"`</li><br />
+
<li>[[["blueMultiplier"]]]</li><br />
<li>`"alphaMultiplier"`</li><br />
+
<li>[[["alphaMultiplier"]]]</li><br />
<li>`"anchorX"`</li><br />
+
<li>[[["anchorX"]]]</li><br />
<li>`"anchorY"`</li><br />
+
<li>[[["anchorY"]]]</li><br />
<li>`"anchorZ"`</li><br />
+
<li>[[["anchorZ"]]]</li><br />
 
</ul><br />
 
</ul><br />
<br />
+
<br /></translate>
 
<source lang="lua">
 
<source lang="lua">
 
  Sprite:set(param,value)
 
  Sprite:set(param,value)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''param''': (string) The name of the parameter <br/>
+
'''param''': (string) <translate>The name of the parameter</translate> <br/>
'''value''': (number) The new value of the specified parameter <br/>
+
'''value''': (number) <translate>The new value of the specified parameter</translate> <br/>
 
=== Examples ===
 
=== Examples ===
 
'''Example'''<br/>
 
'''Example'''<br/>
<source lang="lua">-- the following two lines do the same thing<br />
+
<source lang="lua">-- the following two lines do the same thing
sprite:setX(10)<br />
+
sprite:setX(10)
sprite:set(&quot;x&quot;, 10)<br />
+
sprite:set(&quot;x&quot;, 10)
<br />
+
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
sprite:setY(10)<br />
+
sprite:setY(10)
sprite:set(&quot;y&quot;, 10)<br />
+
sprite:set(&quot;y&quot;, 10)
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
sprite:setRotation(10)<br />
+
sprite:setRotation(10)
sprite:set(&quot;rotation&quot;, 10)<br />
+
sprite:set(&quot;rotation&quot;, 10)
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
sprite:setScaleX(0.5)<br />
+
sprite:setScaleX(0.5)
sprite:set(&quot;scaleX&quot;, 0.5)<br />
+
sprite:set(&quot;scaleX&quot;, 0.5)
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
sprite:setScaleY(0.5)<br />
+
sprite:setScaleY(0.5)
sprite:set(&quot;scaleY&quot;, 0.5)<br />
+
sprite:set(&quot;scaleY&quot;, 0.5)
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
sprite:setScale(0.5)<br />
+
sprite:setScale(0.5)
sprite:set(&quot;scale&quot;, 0.5)<br /></source>
+
sprite:set(&quot;scale&quot;, 0.5)</source>

Revision as of 14:50, 23 August 2018

Available since: Gideros 2011.6

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

Example

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

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

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

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

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