G.js provides a complete set of wrappers around Geometry Dash’s camera and visual trigger system. Every function described in this guide emits one or more GD triggers that affect the camera, color channels, gradients, or global game state. Because these are still trigger-based, they need to be called inside a trigger function context (or at the top level before the level is exported) to take effect at the right moment during gameplay.Documentation 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.
Camera Triggers
camera_offset(x, y, duration?, easing?)
Shifts the camera away from its default position by a fixed amount.
Horizontal offset in GD units. Positive values move the camera right.
Vertical offset in GD units. Positive values move the camera up.
Time in seconds over which the offset is applied.
camera_static(gr, duration?, easing?, easing_rate?, exit_instant?, exit_static?, smooth_vel?, smooth_vel_mod?, follow?, x_only?, y_only?)
Centers the camera on a target group, optionally following it continuously.
Group containing the object to center the camera on.
How long the transition to the target takes.
Easing for camera movement.
Rate modifier for the easing effect.
When
true, exits static mode instantly.When
true, cancels the static camera effect.Adapts the transition to the current camera velocity (no easing recommended when enabled).
Modifier applied to smooth velocity.
When
true, the camera tracks the object continuously rather than centering once.Restrict static mode to the X axis only.
Restrict static mode to the Y axis only.
camera_zoom(zoom_am, duration?, easing?)
Zooms the camera in or out.
Zoom level. Values above 1 zoom in; values below 1 zoom out.
Duration of the zoom animation.
Easing constant for the zoom.
camera_mode(free_mode?, disable_grid_snap?, edit_cam?, easing?, padding?)
Toggles the camera’s free mode and lets you edit advanced camera settings.
Enable or disable free camera mode.
Removes default snapping of the camera center to the nearest grid space.
Must be
true for easing and padding to have any effect.Camera movement easing (requires
edit_cam: true).Camera movement padding (requires
edit_cam: true).camera_rotate(degrees, move_time?, easing?, add?, snap360?)
Rotates the camera view.
Rotation amount in degrees.
Duration of the rotation animation.
Easing constant.
When
true, adds to the current camera rotation rather than setting an absolute angle.Converts the rotation to the closest 360° equivalent.
camera_edge(id, edge)
Fixes one of the camera’s edges to a target object’s position. Useful for implementing custom level boundaries.
Group containing the object that defines the edge position.
Which edge to set. Use one of the four edge constants:
| Constant | Value |
|---|---|
LEFT_EDGE | 1 |
RIGHT_EDGE | 2 |
UP_EDGE | 3 |
DOWN_EDGE | 4 |
Color Triggers
G.js wraps GD’s color channel system in both a functional style (color_trigger) and an object-oriented style via the $color type returned by color(id) and the built-in channel constants.
color_trigger(channel, r, g, b, duration?, opacity?, blending?)
Creates a GD color trigger and returns it as a GJsObject. Call .add() to place it in the level.
The color channel to modify. Can be a channel constant (
BG, GROUND, etc.) or color(n).Red value (0–255).
Green value (0–255).
Blue value (0–255).
Duration of the color transition.
Opacity (0 = transparent, 1 = opaque).
Enables additive blending on the channel.
Color Channel Constants
The following constants are pre-defined$color instances for GD’s named channels:
| Constant | Description |
|---|---|
BG | Background color |
GROUND | Ground color |
LINE | Line color |
OBJECT | Default object color |
GROUND2 | Secondary ground color |
BLACK | Pure black channel |
WHITE | Pure white channel |
LIGHTER | Lighter variant channel |
MIDDLEGROUND | Middleground color |
MIDDLEGROUND_2 | Secondary middleground color |
$color Methods
When you have a color channel variable (from color(n) or a constant like BG), you can call methods directly on it.
.set(c, duration?, blending?)
Sets the color channel to an RGB value.
RGB array from
rgb(r, g, b) or rgba(r, g, b, a).Duration in seconds.
Enable blending.
.copy(c, duration?, hvs?, blending?, opacity?, copy_opacity?)
Copies another color channel into this one.
Source color channel to copy from.
Transition duration.
HVS modifier string (from
hsv()).Enable blending.
Opacity of the resulting color.
Copy the opacity from the source channel too.
.pulse_hsv(h, s, b, s_checked?, b_checked?, fade_in?, hold?, fade_out?, exclusive?)
Pulses the channel with an HSV modifier.
.pulse(c, fade_in?, hold?, fade_out?, exclusive?)
Pulses the channel to an RGB color.
Color Helpers
hsv(hue, sat, bright, sat_checked?, bright_checked?)
Generates a GD-formatted HSV string for use with .copy() and other color operations.
rgb(r, g, b) and rgba(r, g, b, a)
Create color arrays accepted by .set() and .pulse().
Gradient Trigger
gradient(col, col2, bl, br, tl, tr, vertex_mode?, blending?, layer?)
Creates a GD gradient trigger and returns it as a GJsObject. Call .add() to place it.
First color channel.
Second color channel.
Bottom-left vertex group.
Bottom-right vertex group.
Top-left vertex group.
Top-right vertex group.
Use vertex mode.
Enable blending.
Gradient layer (0–15).
Time and Miscellaneous
timewarp(val)
Warps all game time by a multiplier. Values below 1 slow down the level; values above 1 speed it up.
toggle_on_trigger(group_id) and toggle_off_trigger(group_id)
Return toggle triggers as GJsObjects. Call .add() to place them.
hide_player()
Hides the player sprite. Useful for custom death or cutscene sequences.
reverse()
Reverses the level direction (equivalent to a Reverse portal).
speed(x)
Converts a human-readable speed multiplier to the corresponding in-game speed value.
Full Examples
Camera Follow and Zoom
Color Pulse Sequence
Camera Edge Boundaries
Events
Trigger camera changes in response to player input or position.
Control Flow
Sequence and delay visual effects over time.
Keyframes
Animate objects along keyframe paths.
General Purpose API
Full reference for camera, color, and visual trigger functions.