GD Resources logo

Scaling Objects #

OmgRod avatar
Written by:
OmgRod
Owner

Lua Trigger lets you interact with objects through group IDs. One of the ways you can interact with objects is by scaling them. An example of how to scale objects is below:

lua
1while true do
2 Object.scale(
3 5, -- Target group
4 1, -- Center group
5 2, -- Scale X
6 2, -- Scale Y
7 1, -- Duration
8 0, -- Easing Type
9 2, -- Easing Rate
10 { -- Options
11 relativeScale = true
12 }
13 )
14end

The code above scales group 5 to 2x size with center group ID 1 over 1 second.

Object.scale() parameters
ParameterTypeDefaultDescription
targetGroupinteger-Group to scale.
centerGroupinteger-Scaling center.
scaleXnumber-Horizontal scale.
scaleYnumberscaleXVertical scale.
durationnumber0Animation duration.
easingTypeinteger0Easing type (look at easing type docs).
easingRatenumber2.0Easing rate (look at easing rate docs).
optionstable{}Extra scaling options. Look below for more properties.
options parameters
ParameterTypeDefaultDescription
divByXbooleanfalseDivide scaling by the X scale.
divByYbooleanfalseDivide scaling by the Y scale.
onlyMovebooleanfalseOnly move objects instead of resizing them.
relativeScalebooleanfalseApply the scale relative to the current scale.
relativeRotationbooleanfalseRespect each object's current rotation while scaling.