Scenes & lifecycle
Compose scenes from sprites, graphics, and text. Lifecycle hooks make state predictable.
ExoJS gives you scenes, sprites, graphics, input, audio, effects, assets, and rendering primitives — without turning your project into a full game-engine workflow.
import { Application, Color, Scene, Sprite, Texture } from '@codexo/exojs';
class HeroScene extends Scene {
private ship!: Sprite;
async load(loader) {
this.ship = new Sprite(await loader.load(Texture, 'ship.png'));
}
init() {
const { width, height } = this.app.canvas;
this.ship.setAnchor(0.5).setPosition(width / 2, height / 2);
// Pulse and spin — two tweens running in parallel.
this.app.tweens.create(this.ship.scale)
.to({ x: 1.4, y: 1.4 }, 0.9).yoyo(true).repeat(-1).start();
this.app.tweens.create(this.ship)
.to({ rotation: Math.PI }, 1.8).yoyo(true).repeat(-1).start();
}
draw(context) {
context.backend.clear();
context.render(this.ship);
}
}
const app = new Application({
canvas: { width: 960, height: 540 },
clearColor: Color.black,
});
app.start(new HeroScene()); Not a video or a GIF — this is the engine running in the page. Hit play, then open it in the Playground and edit it live.
Preview is paused until you click Play.
Compose scenes from sprites, graphics, and text. Lifecycle hooks make state predictable.
Keyboard, pointer, and gamepad behind one action mapping API.
Buses, effects, and listener-source positioning built on Web Audio.
Post-processing, bloom, blur, particles — composable and GPU-accelerated.
Open any of these in the Playground. The code and preview stay in sync with the running example.
ExoJS ships as plain ES modules. Drop it into Vite, esbuild, or whatever you already use.
Open Getting Startedimport { Application, Scene } from '@codexo/exojs';
class HelloScene extends Scene {
draw(context) {
context.backend.clear();
}
}
const app = new Application({ canvas: { width: 800, height: 600 } });
app.start(new HelloScene());