Skip to main content

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.

G.js lets you create fully-featured Geometry Dash levels using JavaScript. Instead of placing triggers by hand in the editor, you write code — defining groups, colors, trigger functions, counters, events, and more — then export directly to your GD savefile, live editor, or a level string.

Installation

Install via npm and get your first script ready to run.

Quickstart

Build a moving text loop in under 30 lines of JavaScript.

Core Concepts

Understand objects, triggers, groups, colors, and contexts.

API Reference

Full reference for every exported function, class, and constant.

What G.js Does

G.js exposes a global-first API that mirrors Geometry Dash’s trigger system. You create groups with group() or unknown_g(), attach movement and logic with trigger methods, and control timing via wait() and trigger functions.
import '@g-js-api/g.js'

await $.exportConfig({ type: 'savefile', options: { info: true } });

const my_text = unknown_g();

'Hello, World!'
  .to_obj()
  .with(obj_props.X, 45)
  .with(obj_props.Y, 45)
  .with(obj_props.GROUPS, my_text)
  .add();

const moveloop = trigger_function(() => {
  const ctx = $.trigger_fn_context();
  my_text.move(30, 0, 0.5);
  my_text.move(-30, 0, 0.5);
  ctx.call();
});

moveloop.call();

Key Features

Trigger Functions & Contexts

Group triggers into callable functions and manage execution contexts.

Counters & Conditions

Item-based counters with arithmetic, comparisons, and while loops.

Events

React to touch, collision, death, x-position, and frame events.

Camera & Visual Effects

Camera offset, zoom, rotation, static follow, and color triggers.

Particles & Shaders

Particle systems and GD 2.2 shader effects like glitch and chromatic.

Keyframe Animations

Animate groups across position, rotation, and scale with keyframes.

Export Modes

G.js supports four export targets:
ModeDescription
savefileWrites directly to your GD save file
live_editorStreams to the in-game editor via WSLiveEditor
levelstringReturns the raw GD level string
gmdExports to a .gmd file
1

Install G.js

npm install @g-js-api/g.js
2

Configure export

Call $.exportConfig() at the top of your script to set the export target and options.
3

Add objects and triggers

Use group(), trigger_function(), counter(), on(), and the rest of the API to build your level.
4

Run your script

Execute with Node.js — G.js handles encoding and writing to GD automatically.
G.js requires Node.js and works on Windows, macOS, Linux, and Android. Join the Discord server for help and community examples.

Build docs developers (and LLMs) love