For several pets on one page to find each other: there is no element to goTo, only the other pet's feet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pet-pet 🐹
Fork of Akkibi/pet-pet hosted on the homelab Gitea, published to the private registry as
@gabvdl/pet-pet(scripts/publish-gabvdl.sh) for the ai-agent's conversation pets. It addspet.idle(),pet.goNear(),pet.hidden(docs/api.md) andplatforms.cull(docs/world.md); everything else follows upstream (git fetch upstream && git merge upstream/main).
A tiny hamster that lives on your web page. It roams inside the space you give it, picks UI containers and hops onto them, follows your cursor, naps, eats seeds, watches you type, and reacts to what happens on the page (approve, delete, error, success…). Click to pet it, hold to squish it, drag it around and throw it at the walls: it becomes a ragdoll.
Demo: https://akkibi.github.io/pet-pet/ (the "Installer" page walks through setup).
- Zero dependencies, vanilla TypeScript, Canvas2D, with an optional React hook.
- Frame-by-frame animations baked into image strips from layered drawing; the ragdoll is drawn live.
- Sized in viewport units (
10vhby default).
Install
yarn add pet-pet
import { createPet } from 'pet-pet'
const pet = createPet({ container: document.querySelector('main') })
pet.react('success', { say: 'Saved!' })
<button data-pet-react="delete">Delete</button>
<button data-pet-react="approve" data-pet-say="Nice!">Save</button>
<aside data-pet-ignore>…</aside>
React, script tag and bundles: packages/pet-pet/README.md. Every option, method, event and attribute: docs/api.md.
Repository
Yarn workspaces monorepo:
packages/pet-pet: the library published to npm.apps/demo: the React + Tailwind + Leva demo deployed to GitHub Pages.
yarn
yarn dev # demo with test pages and a Leva tweak panel
yarn test # library unit tests
yarn build:lib # packages/pet-pet/dist (ESM, UMD, IIFE, React entry, .d.ts)
yarn build # library, then the demo to apps/demo/dist
Releasing: docs/package.md. License: MIT.