object.yScale

Type Number
Object DisplayObject
Library display.*
Revision 2017.3060
Keywords y, scale, object scaling, size
See also object.xScale

Overview

Retrieve or change the scale of the object in the y direction. The scaling occurs around the object's anchor point.

You can flip a display object vertically by passing a negative value to object.yScale as seen in the example below.

Valid examples include 1.0 for 100%, 2.0 for 200%, or 0.5 for 50%.

Gotchas

Example

local rect1 = display.newRect( 25, 75, 50, 50 )
rect1:setFillColor( 1, 1, 1 )

-- Flip the rectangle vertically
rect1.yScale = -1

local rect2 = display.newRect( 125, 75, 50, 50 )
rect2:setFillColor( 1, 0, 0 )

rect2.yScale = 2  -- Change the vertical scale to 200%