@nanoforge-dev/graphics-2d
v3.0.0
Published
NanoForge Engine - Graphics 2D
Readme
About
@nanoforge-dev/graphics-2d is NanoForge's built-in 2D rendering library, powered by Konva. It creates a full-container Stage and a default Layer and exposes them on Context.graphics. Client-only.
Installation
Node.js 26 or newer is required.
npm install @nanoforge-dev/graphics-2d
yarn add @nanoforge-dev/graphics-2d
pnpm add @nanoforge-dev/graphics-2d
bun add @nanoforge-dev/graphics-2dExample usage
Register Graphics2DLibrary on your client app:
import { Graphics2DLibrary } from "@nanoforge-dev/graphics-2d";
app.use(new Graphics2DLibrary());Draw shapes directly on Context.graphics.stage/.baseLayer:
import { Circle } from "@nanoforge-dev/graphics-2d";
public override async __run(ctx: Context): Promise<void> {
const circle = new Circle({ x: 100, y: 100, radius: 40, fill: "red" });
ctx.graphics.baseLayer.add(circle);
}Links
Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
documentation.
See the contribution guide if you'd like to submit a PR.
Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in discussions.
