@animochi/js
v0.4.0
Published
Framework-neutral verified OTA client for Animochi animations in browsers
Downloads
679
Maintainers
Readme
@animochi/js
Framework-neutral Animochi SDK for browser JavaScript and TypeScript. It synchronizes published releases with ETags, verifies every .animochi package with SHA-256 before caching it, and resolves animation states into browser-ready spritesheet metadata.
Install
npm install @animochi/jsUse
import { AnimochiClient, frameCoordinates, frameIndexAtTime } from "@animochi/js";
const client = new AnimochiClient({
projectId: "your-project-id",
sdkKey: "animochi_...",
apiOrigin: "https://api.animochi.com",
});
await client.sync();
const animation = await client.resolve("wave");
if (animation) {
const frame = frameIndexAtTime(performance.now(), animation.fps, animation.frameCount);
const { column, row } = frameCoordinates(frame, animation.columns);
// Draw the frame from animation.spritesheetUrl onto canvas.
}Create the SDK key and publish a release from SDK & Publishing in the Animochi dashboard. bundledFallback can provide a verified offline-first package; see the exported AnimochiClientOptions type.
