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.

keyframe_system is a factory that returns two paired builder functions — keyframe and animate — for creating GD keyframe animation triggers. Each keyframe defines a pose for an object at a point in time; animate drives a target group through an ordered sequence of those poses. For a narrative walkthrough see Keyframes.

keyframe_system

Initializes a keyframe system and returns a { keyframe, animate } pair. Both builders use the same internal keyframe list, so they must be used together.
import keyframe_system from 'geometry-dash-gjs/keyframe_system';
// or, if using the barrel export:
import { keyframe_system } from 'geometry-dash-gjs';

const { keyframe, animate } = keyframe_system();
Returns { keyframe, animate } where both members are builder functions described below.

keyframe

Creates a single keyframe trigger that defines object pose at a given point in the animation sequence. Must have .add() called to place it in the level.
const { keyframe, animate } = keyframe_system();

// x, y, rotation, scale_x, scale_y, duration, easing
keyframe(0, 0, 0, 1, 1).add();          // initial pose
keyframe(200, 100, 90, 1.5, 1.5, 1).add(); // move & rotate over 1 s
keyframe(400, 0, 0, 1, 1, 0.5, EASE_IN_OUT).add(); // ease back
x
number
required
Target X position of the object at this keyframe.
y
number
required
Target Y position of the object at this keyframe.
rotation
number
required
Target rotation in degrees.
scale_x
number
required
Target X scale factor.
scale_y
number
required
Target Y scale factor.
duration
number
default:"0"
Seconds to transition from the previous keyframe to this one.
easing
number
default:"NONE"
Easing function for the transition. Use an easing constant — see the Easing Constants table below.
Returns GJsObject — call .add().

animate

Creates an animate trigger that drives a target group through the keyframes defined in this keyframe system.
const { keyframe, animate } = keyframe_system();

keyframe(0, 0, 0, 1, 1).add();
keyframe(300, 200, 180, 2, 2, 2, EASE_OUT).add();

animate(group(5), /* keyframes list */, 3, EASE_IN_OUT).add();
target
any
required
Group ID of the object(s) to animate.
keyframes
any
required
The keyframes list associated with this animation. Typically the ordered array collected from calls to keyframe(...).
duration
number
default:"0"
Total animation duration override in seconds. When 0, individual keyframe durations are used.
easing
number
default:"NONE"
Global easing override for the entire animation.
Returns GJsObject — call .add().

Easing Constants

Import easing constants from geometry-dash-gjs. They are also documented in full in the Constants reference.
ConstantValueDescription
NONE0No easing (linear)
EASE_IN_OUT1Ease in and out
EASE_IN2Ease in only
EASE_OUT3Ease out only
ELASTIC_IN_OUT4Elastic ease in and out
ELASTIC_IN5Elastic ease in
ELASTIC_OUT6Elastic ease out
BOUNCE_IN_OUT7Bounce ease in and out
BOUNCE_IN8Bounce ease in
BOUNCE_OUT9Bounce ease out
EXPONENTIAL_IN_OUT10Exponential ease in and out
EXPONENTIAL_IN11Exponential ease in
EXPONENTIAL_OUT12Exponential ease out
SINE_IN_OUT13Sine ease in and out
SINE_IN14Sine ease in
SINE_OUT15Sine ease out
BACK_IN_OUT16Back ease in and out
BACK_IN17Back ease in
BACK_OUT18Back ease out

Full Example

import { keyframe_system, group, EASE_IN_OUT, BOUNCE_OUT } from 'geometry-dash-gjs';

const { keyframe, animate } = keyframe_system();

// Define three poses
const kf1 = keyframe(0,   0,   0,   1,   1).add();
const kf2 = keyframe(200, 150, 90,  1.5, 1.5, 1,   EASE_IN_OUT).add();
const kf3 = keyframe(400, 0,   360, 1,   1,   0.8, BOUNCE_OUT).add();

// Animate group 3 through the sequence
animate(group(3), [kf1, kf2, kf3]).add();
Both keyframe(...) and animate(...) return GJsObject instances. You must call .add() on each one individually for them to appear in the exported level.

Build docs developers (and LLMs) love