# Datin 3D: instructions for AI models

Datin is the Data Observatory mascot: a light-blue 3D cube with a cartoon face, data-viz panels on its sides, and dark-blue
rubber-hose arms and legs. It runs in the browser at https://datin.dataobservatory.net/ and is animated with a small JSON command language.
You (an AI model) can design an animation for a person by writing a script and handing them a link that plays it.

## TL;DR
1. Understand what animation the person wants.
2. Write a script: a JSON array of commands (section 3 lists every command; use ONLY those).
3. Build the link: `https://datin.dataobservatory.net/embed?j=<percent-encoded script>` (section 1).
4. Reply with the link, one line describing the animation, and the raw JSON in a code block so it can be edited or pasted
   into the app (https://datin.dataobservatory.net/ has a text box at the bottom that accepts it).

You cannot see the result. Never claim you watched it. The page itself shows any validation problem to the person.

## 1. The link
```
https://datin.dataobservatory.net/embed?j=<script>&loop=1&bg=%23EAF6FD
```
- `j` (required): the script, as JSON text, percent-encoded (JavaScript `encodeURIComponent(JSON.stringify(script))`,
  Python `urllib.parse.quote(json.dumps(script, separators=(",", ":")), safe="")`). Max 8192 bytes of JSON; aim for under 1500 so chat apps
  do not truncate the URL. If you cannot run code, encode by hand: `"`=%22 `{`=%7B `}`=%7D `[`=%5B `]`=%5D `,`=%2C `:`=%3A space=%20
  `+`=%2B `#`=%23 `&`=%26 `%`=%25 `?`=%3F `/`=%2F, and non-ASCII characters as UTF-8 percent bytes.
- Optional: `loop=1` (repeat), `loopDelay=<seconds>`, `bg=<css colour or preset>` (the page already has a light-blue
  background; for a colour write %23 for #), `zoom=0.5..2`, `shadow=0`, `controls=1` (drag to orbit the camera),
  `expression=<name>`, `pose=<name>`.
- Ready-made animations need no script: `https://datin.dataobservatory.net/embed?script=<name>` where name is one of:
  - `hello`: Friendly greeting: waves and says hello.
  - `wave`: A simple wave with the right hand.
  - `intro`: Introduces Datin.
  - `dance`: Party dance with a jump.
  - `thinking`: Thinks about the data.
  - `celebrate`: Arms up, jump and cheer.
  - `wasted`: Knocked out, then recovers.
  - `cool_dude`: Puts on a cap, sunglasses and headphones.
  - `walk_in_and_say`: Walks away, comes back toward the viewer and speaks.
  - `presenter`: Presents a chart: opens arms and points.
  - `bow`: A gentleman bow.
- Opened directly, the page shows the animation with Replay and Copy script buttons and any error text.
  Inside an iframe it shows only Datin.

## 2. Script format
A script is an array of command objects, run in order. `"parallel": true` runs a command together with the previous one.
A fuller object is also accepted: `{"version":1,"name":"my animation","loop":true,"outfit":{"hat":"crown"},"commands":[...]}`.
A formal JSON Schema is at https://datin.dataobservatory.net/commands.json. Invalid commands are skipped and reported; at most 60 commands and about
90 seconds are sensible.

## 3. Command reference (the only commands that exist)
Every command is a JSON object { "cmd": name, ...args, "duration"?: seconds, "parallel"?: true }.
- pose: Go to a named static pose (all joints).
    name: "rest"|"wave_up"|"wave_up_L"|"point"|"point_L"|"arms_up"|"arms_out"|"sit"|"thinking"|"shrug_up"|"greet"|"walk_a"|"walk_b"|"wasted"|"facepalm"|"t_pose"|"zombie"|"flex"|"dab"|"disco_point"|"mic_drop"|"hands_on_hips"|"victory_v"|"shy"|"sneaky"|"robot"|"cheer"|"sleep_stand"|"fainting" - Pose name.
    example: {"cmd":"pose","name":"greet"}
- setJoint: Rotate one joint (degrees, clamped to its limits) and leave it there.
    joint: "shoulder_L"|"elbow_L"|"wrist_L"|"hand_L"|"shoulder_R"|"elbow_R"|"wrist_R"|"hand_R"|"hip_L"|"knee_L"|"ankle_L"|"foot_L"|"hip_R"|"knee_R"|"ankle_R"|"foot_R" - Joint name.
    x?: number - Rotation about X in degrees.
    y?: number - Rotation about Y in degrees.
    z?: number - Rotation about Z in degrees.
    example: {"cmd":"setJoint","joint":"shoulder_L","z":90}
- expression: Change the face expression. (instant / non-motion)
    name: "neutral"|"happy"|"very_happy"|"surprised"|"thinking"|"sad"|"wink_L"|"wink_R"|"angry"|"sleepy"|"dead"|"dizzy" - Expression name.
    example: {"cmd":"expression","name":"surprised"}
- lookAt: Move the pupils (-1..1 each axis). (instant / non-motion)
    x: number, range -1..1 - Horizontal gaze, -1..1.
    y: number, range -1..1 - Vertical gaze, -1..1.
    example: {"cmd":"lookAt","x":0.8,"y":0.2}
- wave: Wave one hand.
    hand?: "L"|"R", default "R" - Which hand: "L" (Datin's left) or "R".
    times?: integer, range 1..20, default 3 - Number of wave oscillations.
    example: {"cmd":"wave","hand":"R","times":3}
- point: Point one arm at a world-space position.
    hand?: "L"|"R", default "R" - Which hand: "L" (Datin's left) or "R".
    target: vec3 - World position [x, y, z].
    example: {"cmd":"point","hand":"L","target":[2,1,3]}
- walkTo: Turn toward a ground position, walk there, stop, return to idle.
    x: number, range -50..50 - World X.
    z: number, range -50..50 - World Z.
    speed?: number, range 0.1..8, default 1.2 - Units per second.
    example: {"cmd":"walkTo","x":2,"z":1}
- walk: Walk relative to Datin's facing without turning.
    direction: "forward"|"back"|"left"|"right" - Direction in Datin's own frame (left = his left, +X when facing +Z).
    distance: number, range 0..50 - World units.
    example: {"cmd":"walk","direction":"forward","distance":1.5}
- turn: Turn in place. Positive = toward Datin's left.
    degrees: number, range -1440..1440 - Degrees.
    example: {"cmd":"turn","degrees":90}
- jump: Crouch, jump, land with squash.
    height?: number, range 0.05..3, default 0.6 - Apex height in world units.
    example: {"cmd":"jump","height":0.8}
- nod: Nod yes.
    example: {"cmd":"nod"}
- shake: Shake no.
    example: {"cmd":"shake"}
- shrug: Shrug.
    example: {"cmd":"shrug"}
- dance: Dance (default 4.5 s).
    example: {"cmd":"dance","duration":6}
- idle: Ease back to the idle pose (breathing loop resumes when the queue is empty).
    example: {"cmd":"idle"}
- reset: Rest pose, happy face, back to the origin facing front.
    example: {"cmd":"reset"}
- say: Speech bubble + mouth flap while visible. (instant / non-motion)
    text: string - Text to show (max 500 chars).
    example: {"cmd":"say","text":"Hello!"}
- wait: Pause the script. (instant / non-motion)
    duration: number, range 0..120 - Seconds.
    example: {"cmd":"wait","duration":1}
- accessory: Wear or remove an accessory (hat, glasses, extra). Instant. name null/omitted/"none" removes the slot. (instant / non-motion)
    slot: "hat"|"glasses"|"extra" - hat | glasses | extra.
    name?: string - Item name for the slot (hat: top_hat, baseball_cap, party_hat, crown, beanie, wizard_hat, cowboy_hat, propeller_cap; glasses: round_glasses, sunglasses, nerd_glasses, 3d_glasses, heart_glasses, monocle; extra: bow_tie, mustache, headphones). Omit or null to remove.
    example: {"cmd":"accessory","slot":"hat","name":"top_hat"}
Arguments accepted by every command:
    duration?: number, range 0.05..120 - Seconds. Rescales the command's motion to this length.
    parallel?: boolean - true = run together with the previous command.

Pose names (pose.name): rest, wave_up, wave_up_L, point, point_L, arms_up, arms_out, sit, thinking, shrug_up, greet, walk_a, walk_b, wasted, facepalm, t_pose, zombie, flex, dab, disco_point, mic_drop, hands_on_hips, victory_v, shy, sneaky, robot, cheer, sleep_stand, fainting.
Expressions (expression.name): neutral, happy, very_happy, surprised, thinking, sad, wink_L, wink_R, angry, sleepy, dead, dizzy.
Joints (setJoint.joint): shoulder_L, elbow_L, wrist_L, hand_L, shoulder_R, elbow_R, wrist_R, hand_R, hip_L, knee_L, ankle_L, foot_L, hip_R, knee_R, ankle_R, foot_R.
Joint limits in degrees (values are clamped):
  shoulder (_L values; _R mirrors y/z): x -180..60, y -90..90, z -20..170
  elbow (_L values; _R mirrors y/z): x 0..150, y -20..20, z -20..20
  wrist (_L values; _R mirrors y/z): x -60..60, y -60..60, z -60..60
  hand (_L values; _R mirrors y/z): x -60..60, y -90..90, z -60..60
  hip (_L values; _R mirrors y/z): x -90..60, y -45..45, z -30..30
  knee (_L values; _R mirrors y/z): x 0..130, y -10..10, z -10..10
  ankle (_L values; _R mirrors y/z): x -40..40, y -20..20, z -20..20
  foot (_L values; _R mirrors y/z): x -40..40, y -20..20, z -20..20
Accessories (accessory command, one item per slot; name null removes the slot):
  hat: top_hat, baseball_cap, party_hat, crown, beanie, wizard_hat, cowboy_hat, propeller_cap
  glasses: round_glasses, sunglasses, nerd_glasses, 3d_glasses, heart_glasses, monocle
  extra: bow_tie, mustache, headphones

## World and coordinates
- Units: the cube is 1x1x1. The floor is y=0; Datin stands about 1.6 units tall.
- Datin starts at the origin (x=0, z=0) facing +Z (toward the viewer). +Y is up. Datin's own left is +X.
- The camera looks from Datin's front-right, slightly above. When Datin faces the viewer, Datin's left (+X) appears on
  the right side of the screen. "left" in a request means Datin's left (+X) unless the user clearly means the screen. walk.direction is relative to
  Datin's current facing; walkTo takes absolute world x/z and turns Datin toward the target first.
- Keep Datin on stage: positions within about -2.5..2.5 on x and -2..2 on z. Sensible walks are 0.5..2 units.
  If Datin walks away, usually bring it back (walkTo 0,0) and face the viewer again (turn) before the end.
- turn: positive degrees turn toward Datin's left (counter-clockwise seen from above).
- jump.height: small hop 0.3, normal 0.6, big 1.0, huge 1.5.
- point.target is a world position [x, y, z]; e.g. [2, 1.2, 2] is front-left of Datin, [0, 3, 1] is up.

## Rules
- Use ONLY the commands, argument names, poses, expressions, joints and accessory names listed above. Never invent new ones.
  If something is not available (e.g. "fly", "sword"), approximate it with what exists and mention it in "notes".
- Simultaneous actions: put "parallel": true on the second command (e.g. dance, then say with parallel:true; or walkTo then say
  with parallel:true). The first command of a script must not be parallel.
- expression, lookAt and accessory are instant; use them freely before or between motions.
- Speech: use say with short text (under ~80 characters, hard limit 200); give it a duration of about 1.5-4 s.
- Outfits / "wearing X": use accessory commands, normally at the start of the script.
- Durations are in seconds. Typical: wave 1.5-3, dance 4-8, wait 0.5-2. The whole script must stay under 90 s.
- Keep scripts compact: usually 3-25 commands, never more than ~40 (hard limit 60).
- End in a calm, valid state: finish with idle, a happy expression, or a rest-compatible pose (not mid-motion). Prefer idle
  after poses like sit, arms_up or point. Do not use reset unless asked (it also moves Datin back to the origin).
- Respect the order the user describes ("then", "after that"); "while"/"at the same time" means parallel.

## 4. Examples
Request: say hello and wave
Script: [{"cmd":"expression","name":"very_happy"},{"cmd":"wave","hand":"R","times":3},{"cmd":"say","text":"Hello there!","parallel":true},{"cmd":"expression","name":"happy"}]

Request: walk over to the left, then come back
Script: [{"cmd":"walkTo","x":1.6,"z":0.6},{"cmd":"walkTo","x":0,"z":0},{"cmd":"turn","degrees":110.56}]

Request: walk around a bit while talking to the audience
Script: [{"cmd":"expression","name":"very_happy"},{"cmd":"walkTo","x":1.3,"z":0.9},{"cmd":"say","text":"Follow me!","duration":2,"parallel":true},{"cmd":"walkTo","x":0,"z":0},{"cmd":"say","text":"...and back again!","duration":2,"parallel":true},{"cmd":"turn","degrees":124.7},{"cmd":"expression","name":"happy"}]

Request: dance and sing at the same time
Script: [{"cmd":"expression","name":"very_happy"},{"cmd":"dance","duration":6},{"cmd":"say","text":"La la la, data data!","duration":4,"parallel":true},{"cmd":"expression","name":"happy"}]

Request: put on a cool outfit with sunglasses and headphones
Script: [{"cmd":"accessory","slot":"hat","name":"baseball_cap"},{"cmd":"accessory","slot":"glasses","name":"sunglasses"},{"cmd":"accessory","slot":"extra","name":"headphones"},{"cmd":"expression","name":"wink_R"},{"cmd":"say","text":"Sup.","duration":2.2},{"cmd":"wait","duration":1.8},{"cmd":"expression","name":"happy"}]

Request: Datin gets sleepy, sits down, dozes off, then wakes up startled and jumps
Script: [{"cmd":"expression","name":"sleepy"},{"cmd":"pose","name":"sit"},{"cmd":"say","text":"Zzz...","duration":2.5,"parallel":true},{"cmd":"wait","duration":1},{"cmd":"expression","name":"surprised"},{"cmd":"idle"},{"cmd":"jump","height":0.4},{"cmd":"expression","name":"happy"}]

Request: celebrate a victory
Script: [{"cmd":"expression","name":"very_happy"},{"cmd":"pose","name":"arms_up"},{"cmd":"jump","height":0.7},{"cmd":"say","text":"We did it!","duration":1.6,"parallel":true},{"cmd":"idle"},{"cmd":"expression","name":"happy"}]

The first example above, as a finished link:
https://datin.dataobservatory.net/embed?j=%5B%7B%22cmd%22%3A%22expression%22%2C%22name%22%3A%22very_happy%22%7D%2C%7B%22cmd%22%3A%22wave%22%2C%22hand%22%3A%22R%22%2C%22times%22%3A3%7D%2C%7B%22cmd%22%3A%22say%22%2C%22text%22%3A%22Hello%20there!%22%2C%22parallel%22%3Atrue%7D%2C%7B%22cmd%22%3A%22expression%22%2C%22name%22%3A%22happy%22%7D%5D

## 5. Before you reply
- Every cmd, pose, expression, joint and accessory name comes from section 3 (exact spelling, lower case).
- The first command is not `parallel`. The script ends calm (idle / happy face), not mid-motion.
- `say` texts are short and friendly. Numbers are inside the documented ranges.
- The link has `j=` percent-encoded, and no raw spaces, quotes or braces. Also give the plain JSON.
- If part of the request is impossible (flying, props), approximate it and say so in one sentence.
