Groups are the primary way to target and animate objects in Geometry Dash. Every object can belong to one or more groups, and triggers operate on groups rather than individual objects. In G.js theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/g-js-api/G.js/llms.txt
Use this file to discover all available pages before exploring further.
$group class wraps a numeric group ID and exposes every group-related trigger as a chainable method, so you never need to construct trigger dictionaries by hand.
For a conceptual overview see Groups, Colors & Blocks.
Creating Groups
group(id)
Creates a $group instance from a known group ID. G.js marks this ID as in-use so it will not be allocated again by unknown_g().
The GD group ID (1–9999).
$group
unknown_g()
Allocates and returns the next free group ID. Use this whenever you need a group but do not care about its exact number.
$group
new $group(a, specific?)
The underlying class constructor. Prefer group() and unknown_g() in day-to-day code; use the constructor when you need fine-grained control.
The group ID value.
When
true (the default), marks this ID as unavailable for future
unknown_g() allocations.$group is also a named TypeScript export for use in type annotations:
Methods
call(delay?)
Calls (activates) the group, firing any spawn triggers assigned to it.
Seconds to wait before the call fires.
move(x, y, duration?, easing?, easing_rate?, x_multiplier?, y_multiplier?, multiply?, silent?)
Creates a Move trigger that shifts the group by (x, y) units.
Distance to move along the X axis.
Distance to move along the Y axis.
How long the movement takes, in seconds.
Easing curve to apply. See Easing constants.
Easing rate multiplier.
Multiplier applied to movement on the X axis.
Multiplier applied to movement on the Y axis.
When
true, fits the movement amount into GD units (multiplying by 3).When
true, the move trigger takes no time (instant snap).precise_move(x, y, duration, easing?, easing_rate?, single?)
Combines a Move trigger with a Follow trigger to achieve sub-pixel decimal movement accuracy (up to 2 decimal places). Coordinates use 10 units per grid square.
Units to move on X (10 = one grid square).
Units to move on Y (10 = one grid square).
Duration of the movement in seconds.
Easing curve. See Easing constants.
Easing rate multiplier.
When
true, saves groups and trigger objects if the group contains only one object.scale(center, scale_x, scale_y, duration?, easing?, easing_rate?, x_divide?, y_divide?, move_only?, relative_scale?, relative_rot?)
Creates a Scale trigger that resizes the group around center.
The group to use as the scaling pivot point.
Scale factor on the X axis.
Scale factor on the Y axis.
Duration of the scale animation in seconds.
Easing curve.
Easing rate multiplier.
When
true, divides the current X scale by scale_x instead of multiplying.When
true, divides the current Y scale by scale_y instead of multiplying.Emulates scaling by moving child objects, without changing their actual scale values.
Bases scaling on the reference (center) object.
Rotates the X and Y axes relative to the center object’s rotation.
rotate(center, degrees, duration?, easing?, easing_rate?, lock_object_rotation?)
Creates a Rotate trigger around the center group.
Group to rotate around.
Degrees to rotate. Positive = clockwise.
Duration in seconds.
Easing curve.
Easing rate multiplier.
When
true, enables “Lock Object Rotation” on the trigger so child objects do not rotate around their own axes.follow(other, x_mod?, y_mod?, duration?)
Creates a Follow trigger that makes this group mirror the movement of other.
The group to follow.
Speed modifier on the X axis. Values below 1 slow the follow, above 1 amplify it.
Speed modifier on the Y axis.
How many seconds the follow lasts.
0 means indefinite.follow_lerp(groupA, groupB, weight?, duration?)
Keeps the group’s position proportionally between two other groups using linear interpolation.
First reference group.
Second reference group.
Interpolation weight (0 = fully at A, 1 = fully at B).
Duration in seconds.
0 means indefinite.follow_player_y(speed?, delay?, offset?, max_speed?, duration?)
Creates a Follow Player Y trigger that locks the group to the player’s vertical position.
How quickly the group snaps to the player’s Y position.
Seconds of delay before the group starts following.
Vertical offset from the player’s Y position.
Maximum speed at which the group can move.
0 = unlimited.How long the follow lasts.
0 = indefinite.move_to(target, duration?, x_only?, y_only?, easing?, easing_rate?)
Creates a Move To trigger that moves the group to the position of target.
The target group whose position to move to.
Duration of movement in seconds.
Only move on the X axis.
Only move on the Y axis.
Easing curve.
Easing rate multiplier.
move_to_xy(x, y, duration?, easing?, easing_rate?)
Moves the group to an absolute coordinate (x, y) rather than to another group.
Target X coordinate.
Target Y coordinate.
Duration in seconds.
Easing curve.
Easing rate multiplier.
alpha(opacity?, duration?)
Creates an Alpha trigger that changes the group’s opacity.
Target opacity, where
0 is fully transparent and 1 is fully opaque.Duration of the fade in seconds.
lock_to_player(lock_x?, lock_y?, duration?)
Creates a Lock to Player trigger that pins the group to the player’s position.
Lock to the player’s X axis.
Lock to the player’s Y axis.
How many seconds the lock lasts.
stop()
Creates a Stop trigger that halts all active move/rotate/follow triggers targeting this group.
pause()
Pauses active triggers on the group without removing them.
resume()
Resumes previously paused triggers on the group.
toggle_on()
Creates a Toggle trigger (on variant) that makes the group’s objects visible and active.
toggle_off()
Creates a Toggle trigger (off variant) that hides and deactivates the group’s objects.
pulse(c, fade_in?, hold?, fade_out?, exclusive?)
Creates a Pulse trigger targeting this group using an RGB color.
RGB color array, e.g.
[255, 128, 0].Seconds to fade into the pulse color.
Seconds to hold the pulse color at full intensity.
Seconds to fade back to the original color.
When
true, this pulse takes priority over simultaneous pulses on the same target.pulse_hsv(h, s, b, s_checked?, b_checked?, fade_in?, hold?, fade_out?, exclusive?)
Creates a Pulse trigger targeting this group using HSV values instead of RGB.
Hue offset (-180 to 180).
Saturation value.
Brightness value.
When
true, the saturation value is used as an absolute value rather than an offset.When
true, the brightness value is used as an absolute value rather than an offset.Fade-in time in seconds.
Hold time in seconds.
Fade-out time in seconds.
Prioritize over simultaneous pulses.
animate(anim_id?)
Creates an Animate trigger for monsters and animated objects.
Animation ID. You can also use the
animations helper object (e.g. animations.bat.attack01) to find the correct ID without looking it up manually.remap(...mps)
Remaps group IDs inside this group to new ones. Pass pairs of [from, to] group arguments.
Pairs of groups to remap. Each call accepts any number of
[source, destination] group pairs, e.g. remap([group(1), group(2)], [group(4), group(3)]).this (chainable)
Easing constants
Pass these to anyeasing parameter. They are all exported from @g-js-api/g.js/safe.
| Constant | Description |
|---|---|
NONE | No easing (linear) |
EASE_IN | Ease in |
EASE_OUT | Ease out |
EASE_IN_OUT | Ease in and out |
ELASTIC_IN | Elastic ease in |
ELASTIC_OUT | Elastic ease out |
ELASTIC_IN_OUT | Elastic ease in and out |
BOUNCE_IN | Bounce ease in |
BOUNCE_OUT | Bounce ease out |
BOUNCE_IN_OUT | Bounce ease in and out |
EXPONENTIAL_IN | Exponential ease in |
EXPONENTIAL_OUT | Exponential ease out |
EXPONENTIAL_IN_OUT | Exponential ease in and out |
SINE_IN | Sine ease in |
SINE_OUT | Sine ease out |
SINE_IN_OUT | Sine ease in and out |
BACK_IN | Back ease in |
BACK_OUT | Back ease out |
BACK_IN_OUT | Back ease in and out |