Retrieve or change the scale of the object in the x-direction.

The scaling occurs around the object's reference point. The default reference point for most Display Objects is center.


local var = object.xScale
object.xScale = value


local rect1 = display.newRect(25, 100, 50, 50)
rect1:setFillColor(170, 170, 170)
local rect2 = display.newRect(125, 100, 50, 50)
rect2:setFillColor(255, 255, 255)
rect2.xScale = 2  -- Scale the X value 200%


The current X scale value.


Value examples: 1.0 is 100%. 0.5 is 50%.

The X scale and Y scale value can also be set by object:scale() API.

Note: When a Display Object is converted into a physics object, scaling the Display Object will change the physical size but NOT affect the physics view of he object. This could result in unpredictable results when interacting with other physics bodies.

Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 1.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 1.0c
  • Android:
    Corona SDK 2.0