Skip to content

Sprite Zdog

Sprite Zdog gives Sprite a canvas renderer and three ready-made characters, mushroom, cat and burger, so you can show one without drawing it yourself.

  • @fungi.computer/sprite-zdog
  • v0.2.0
  • MIT

Fastest path

  1. Install

    Add it to your project with npm, pnpm, Yarn or Bun.

    TERMINAL
    npm install @fungi.computer/sprite-zdog
  2. Author a portable character

    Builds a tiny Zdog scene with defineSprite, checks it, then converts it to the JSON character document Sprite renders. No canvas or DOM needed.

    home.ts
    import {
    check,
    defineSprite,
    toCharacter,
    } from "@fungi.computer/sprite-zdog/author";
    const dot = defineSprite({
    apiVersion: 1,
    name: "dot",
    palette: { body: "#4caf50" },
    build: ({ scene, color }) => ({
    root: scene.ellipse({ width: 20, height: 20, color: color("body") }),
    }),
    expressions: { normal: {} },
    });
    console.log(check(dot).nodeCount); // 1
    console.log(toCharacter(dot).renderer); // "zdog"