跳转到内容
查看源码

restore自动生成

分类:创作协议 · Session

恢复一个快照的世界(先做一次不提交的试运行帧)。

Puts a snapshot’s world back, after a trial frame that commits nothing: the state is the snapshot’s, which the next frame reads; until then read shows the trial frame’s outputs.

{"id": 1, "op": "restore", "laws": "current"}
名称 类型 必需 说明
snapshot object 否 as snapshot gave it; or from
from string 否 a file snapshot wrote
laws "current" | "snapshot" 是 which Kernels the restored world runs under
structure "current" | "snapshot" 否 which scene; current when not given
time number 否 session time in seconds; 0 when not given
rate number 否 the sound clock, frames a second, which Kernels read as rate()
queued number 否 the samples (per channel) the sound device holds and has not played, which Kernels read as queued(); 0 when not given
pointer [x, y] 否 the pointer in the output’s pixels from its top left, as a Kernel’s pointer() reads it
down bool 否 whether the pointer is pressed, what pointer_down() reads
buttons [integer] 否 buttons held: 0 left, 1 right, 2 middle, then a pad’s
wheel [x, y] 否 the scroll for this frame
sticks [[x, y]] 否 a pad’s left stick, right stick and triggers, up to three pairs
pads integer 否 how many pads are connected, what pads() reads
keys [integer] 否 keys held, by the browser’s codes
text string 否 the characters typed since the last evaluation, what typed() reads; 32 at most
window [w, h] 否 the window in pixels; else the session’s
scale number 否 the window’s scale factor, with window; 1 when not given

revision, frame, report