Type Number Object DisplayObject Library display.* Revision 2019.3470 Keywords y, scale, object scaling, size See also object.xScale
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%.
yScale property can also be set as part of the object:scale() function.
When a display object is converted into a physics object, scaling the object will change the visual size, but it will not affect how the physics engine regards the object size. This could result in unpredictable results when interacting with other physics bodies.
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%