Menu
Behavior
How the pet decides what to do, and how to tune it.
Modes
The pet ticks 8 times a second and is always in one of 3 modes, checked in this order.
| Mode | When | Default | Description |
|---|---|---|---|
| hover | cursor near | — | Stops and plays hoverAction. The bubble shows. |
| idle | at target | — | Rests and cycles idleActions. |
| walking | otherwise | — | Moves toward the target with a movementAction. |
Tuning
Pass any of these in behavior. Omit the rest.
<WebPet
animal="turtle"
color="orange"
behavior={{
hoverAction: "with_ball",
idlePauseMs: { min: 3000, max: 6000 },
movementActions: [{ name: "walk", speedMultiplier: 1 }],
}}
/>| Prop | Type | Default | Description |
|---|---|---|---|
| hoverAction | string | "swipe" | Action played while the cursor is near. |
| hoverDist | number | 50 | Radius in px that counts as near. |
| idleDist | number | 48 | Distance from target at which the pet stops. |
| idlePauseMs | { min, max } | { 1500, 2200 } | Rest between walks. |
| idleActions | IdleAction[] | idle, swipe | Poses cycled while resting. |
| movementActions | MovementAction[] | walk, walk_fast, run | One is picked per walk. |
| actions | string[] | from manifest | GIFs the animal has. Others fall back. |