Run steps and watch the scene
three_playRuns a three.js page headless, executes interaction steps, watches live scene values after each frame, and validates expect claims with errors and a screenshot.
Instructions
Prove that a change does what it should. Open the page headless, run steps (click, press, hold, drag, wheel, wait, frames, eval, until) and read watch expressions in the live scene after every frame and step, with scene, camera, renderer, info (renderer.info), $('name') and $$('Type') in scope (window globals such as app work too). expect claims are judged at the end, at any moment or at every frame, each pass or fail with its value, time, frame and step. Watched values come back only where they changed. Also page and console errors with explanations, and a screenshot. When it passes, keep it with three_scenario op save.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"target": "<target>"
},
"name": "three_play"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | No | folder to serve when the page needs files above its own folder | |
| wait | No | ms to let the scene run before the first step (default 1000) | |
| entry | No | ||
| steps | No | Steps in order: {"type":"click","selector":"#start"} or {x,y}, {"type":"press","key":"Space"}, {"type":"hold","key":"ArrowRight","ms":300}, {"type":"drag","from":[x,y],"to":[x,y]}, {"type":"wheel","deltaY":200}, {"type":"wait","ms":500}, {"type":"wait-for","selector":"canvas"}, {"type":"frames","n":10}, {"type":"eval","js":"app.start()"}, {"type":"until","js":"$('ball').position.y < 0","timeout":5000}. | |
| watch | No | JS expressions to follow, e.g. $('player').position, info.render.calls | |
| width | No | ||
| expect | No | Claims about the scene: "$('player').position.y > 1 @ end", "any: $('door').rotation.y > 1", "always: info.render.calls < 200", "x @ step 2", or {js, at}. | |
| height | No | ||
| ignore | No | ||
| target | Yes | Folder with the page (index.html), or the http(s) URL of a running dev server. | |
| webgpu | No | ||
| sample_ms | No | ||
| screenshot | No |