@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/apps/studio/dist/assets/Workspace-Dr-hVeFd.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DMrVed-J.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DL9veUlN.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-C6juWzGV.js +1984 -0
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/inspector3d-sqergHSP.js +1 -0
- package/apps/studio/dist/index.html +4 -3
- package/apps/studio/dist-host/studio-host.mjs +262 -3
- package/bin/mosio +0 -0
- package/bin/mosio-agent +0 -0
- package/crates/mosio/src/adapters/mosio-three.js +112 -8
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +205 -6
- package/fixtures/camera-inspect/mosio.json +56 -0
- package/fixtures/camera-inspect/scenes/behind.html +22 -0
- package/fixtures/camera-inspect/scenes/cut.html +18 -0
- package/fixtures/camera-inspect/scenes/edges.html +18 -0
- package/fixtures/camera-inspect/scenes/good.html +23 -0
- package/fixtures/camera-inspect/scenes/read.html +22 -0
- package/fixtures/camera-inspect/scenes/shake.html +23 -0
- package/fixtures/camera-inspect/scenes/speed.html +18 -0
- package/fixtures/camera-inspect-vertical/mosio.json +31 -0
- package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
- package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
- package/fixtures/cloudrun-gpu/audio/music.wav +0 -0
- package/fixtures/cloudrun-gpu/audio/vo.wav +0 -0
- package/fixtures/cloudrun-gpu/mosio.json +18 -0
- package/fixtures/cloudrun-gpu/scenes/cube.html +25 -0
- package/fixtures/direct-seek/mosio.json +4 -0
- package/fixtures/direct-seek/scenes/clock.html +9 -0
- package/fixtures/direct-seek/scenes/meta.html +11 -0
- package/fixtures/direct-seek/scenes/pure.html +11 -0
- package/fixtures/direct-seek/scenes/slow.html +11 -0
- package/fixtures/direct-seek-media/mosio.json +6 -0
- package/fixtures/direct-seek-media/scenes/pure.html +11 -0
- package/fixtures/gl-readback/mosio.json +16 -0
- package/fixtures/gl-readback/scenes/compositor.html +23 -0
- package/fixtures/gl-readback/scenes/readback.html +23 -0
- package/fixtures/inspect-physics/expect.json +18 -0
- package/fixtures/inspect-physics/mosio.json +29 -0
- package/fixtures/inspect-physics/scenes/calm.html +46 -0
- package/fixtures/inspect-physics/scenes/physics.html +47 -0
- package/package.json +1 -1
- package/primitives/README.md +23 -2
- package/primitives/example/shared/mosio-prims.js +349 -1
- package/primitives/impact-burst/golden/f030.png +0 -0
- package/primitives/impact-burst/golden/f032.png +0 -0
- package/primitives/impact-burst/golden/f036.png +0 -0
- package/primitives/impact-burst/impact-burst.js +51 -0
- package/primitives/impact-burst/primitive.json +130 -0
- package/primitives/impact-burst/scene.html +24 -0
- package/primitives/stick-figure/golden/f030.png +0 -0
- package/primitives/stick-figure/golden/f092.png +0 -0
- package/primitives/stick-figure/golden/f140.png +0 -0
- package/primitives/stick-figure/primitive.json +179 -0
- package/primitives/stick-figure/scene.html +40 -0
- package/primitives/stick-figure/stick-figure.js +297 -0
- package/primitives/zoom-through/primitive.json +7 -2
- package/primitives/zoom-through/zoom-through.js +6 -5
- package/scripts/3d-acceptance.sh +8 -1
- package/scripts/3d-attach-bench.mjs +119 -0
- package/scripts/3d-bake-room-env.mjs +74 -0
- package/scripts/3d-e2b-job.sh +1 -0
- package/scripts/3d-gen-heavy-fixture.py +65 -0
- package/scripts/3d-trace-summary.py +14 -0
- package/scripts/acceptance/camera-inspect.sh +49 -0
- package/scripts/acceptance/direct-seek.sh +68 -0
- package/scripts/acceptance/export.sh +5 -3
- package/scripts/acceptance/frames.sh +7 -2
- package/scripts/acceptance/hardening.sh +37 -6
- package/scripts/acceptance/hub.sh +208 -0
- package/scripts/acceptance/inspect.sh +21 -2
- package/scripts/acceptance/revisions-git.sh +137 -0
- package/scripts/acceptance/revisions-sync.sh +323 -0
- package/scripts/acceptance/revisions.sh +118 -4
- package/scripts/acceptance/segcache.sh +100 -0
- package/scripts/acceptance/split.sh +78 -0
- package/scripts/bootstrap.sh +20 -1
- package/scripts/check-error-codes.py +9 -1
- package/scripts/check-file-size.sh +45 -0
- package/scripts/ci.sh +4 -4
- package/scripts/dedupe-report.sh +47 -0
- package/scripts/e2b/template/provision.sh +1 -1
- package/scripts/fastpath/cdp.mjs +25 -0
- package/scripts/fastpath/dbg.mjs +11 -0
- package/scripts/fastpath/e2b.mjs +40 -0
- package/scripts/fastpath/features/gen.py +109 -0
- package/scripts/fastpath/features/mosio.json +100 -0
- package/scripts/fastpath/features/scenes/backdrop.html +11 -0
- package/scripts/fastpath/features/scenes/blend.html +11 -0
- package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
- package/scripts/fastpath/features/scenes/filter.html +11 -0
- package/scripts/fastpath/features/scenes/gradient.html +11 -0
- package/scripts/fastpath/features/scenes/iframe.html +11 -0
- package/scripts/fastpath/features/scenes/image.html +11 -0
- package/scripts/fastpath/features/scenes/svg.html +11 -0
- package/scripts/fastpath/features/scenes/text.html +11 -0
- package/scripts/fastpath/features/scenes/typo.html +11 -0
- package/scripts/fastpath/features/scenes/video.html +11 -0
- package/scripts/fastpath/features/scenes/video2.html +11 -0
- package/scripts/fastpath/features-xfade/mosio.json +49 -0
- package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
- package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
- package/scripts/fastpath/fixtures/gen_layout.py +80 -0
- package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
- package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
- package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
- package/scripts/fastpath/fp.mjs +91 -0
- package/scripts/fastpath/inpage.js +68 -0
- package/scripts/fastpath/recipes.py +49 -0
- package/scripts/fastpath/sandbox.sh +68 -0
- package/scripts/fastpath/sandbox10.sh +57 -0
- package/scripts/fastpath/sandbox11.sh +18 -0
- package/scripts/fastpath/sandbox12.sh +30 -0
- package/scripts/fastpath/sandbox13.sh +16 -0
- package/scripts/fastpath/sandbox14.sh +28 -0
- package/scripts/fastpath/sandbox15.sh +36 -0
- package/scripts/fastpath/sandbox16.sh +60 -0
- package/scripts/fastpath/sandbox17.sh +34 -0
- package/scripts/fastpath/sandbox18.sh +59 -0
- package/scripts/fastpath/sandbox19.sh +67 -0
- package/scripts/fastpath/sandbox2.sh +41 -0
- package/scripts/fastpath/sandbox20.sh +34 -0
- package/scripts/fastpath/sandbox21.sh +22 -0
- package/scripts/fastpath/sandbox22.sh +22 -0
- package/scripts/fastpath/sandbox23.sh +21 -0
- package/scripts/fastpath/sandbox3.sh +151 -0
- package/scripts/fastpath/sandbox4.sh +161 -0
- package/scripts/fastpath/sandbox5.sh +69 -0
- package/scripts/fastpath/sandbox6.sh +85 -0
- package/scripts/fastpath/sandbox7.sh +81 -0
- package/scripts/fastpath/sandbox8.sh +62 -0
- package/scripts/fastpath/sandbox9.sh +130 -0
- package/scripts/fastpath/srv.mjs +15 -0
- package/scripts/fastpath/www/probe.html +1 -0
- package/scripts/gen-media-fixtures.sh +1 -0
- package/scripts/gl-readback-check.sh +26 -0
- package/scripts/hpbench/make-bench-fixtures.sh +43 -0
- package/scripts/hpbench/render-cgroup.sh +56 -0
- package/scripts/install.sh +2 -1
- package/scripts/npm-clean-install-proof-win.sh +64 -0
- package/scripts/platform-smoke.sh +80 -0
- package/scripts/prim.mjs +31 -13
- package/scripts/user-journey.sh +68 -0
- package/skills/mosio-3d/SKILL.md +31 -3
- package/skills/mosio-brief/SKILL.md +80 -0
- package/skills/mosio-brief/references/brief.md +141 -0
- package/skills/mosio-brief/references/copy.md +99 -0
- package/skills/mosio-brief/references/narration.md +61 -0
- package/skills/mosio-brief/references/storyboard.md +98 -0
- package/skills/mosio-collab/SKILL.md +104 -0
- package/skills/mosio-collab/references/hub.md +62 -0
- package/skills/mosio-engine/SKILL.md +44 -13
- package/skills/mosio-engine/references/camera.md +12 -2
- package/skills/mosio-engine/references/character.md +88 -0
- package/skills/mosio-engine/references/checks.md +11 -4
- package/skills/mosio-engine/references/delivery.md +29 -2
- package/skills/mosio-engine/references/kit-primitives.md +8 -4
- package/skills/mosio-engine/references/layout.md +8 -0
- package/skills/mosio-engine/references/plan.md +3 -1
- package/skills/mosio-engine/references/project.md +15 -3
- package/skills/mosio-engine/references/publish.md +79 -0
- package/skills/mosio-engine/references/registry.md +27 -15
- package/skills/mosio-engine/references/timeline.md +19 -1
- package/skills/mosio-engine/references/timing.md +2 -1
- package/skills/mosio-import/SKILL.md +1 -1
- package/skills/mosio-import/references/from-hyperframes.md +1 -1
- package/skills/mosio-import/references/from-remotion.md +1 -1
- package/skills/mosio-media/SKILL.md +16 -4
- package/skills/mosio-media/references/audio.md +29 -11
- package/skills/mosio-media/references/captions.md +26 -5
- package/skills/mosio-media/references/editing.md +70 -0
- package/skills/mosio-media/references/footage.md +40 -8
- package/skills/mosio-media/references/voice.md +52 -7
- package/skills/mosio-replicate/references/mosio.md +1 -1
- package/toolchain.lock.json +151 -4
- package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
- package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
- package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
- package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
|
@@ -20,6 +20,84 @@
|
|
|
20
20
|
const fromLib = () => /\/_lib\//.test(new Error().stack || "");
|
|
21
21
|
const markClock = (kind) => { if (!fromLib()) { stateful = true; why.add(kind); } };
|
|
22
22
|
|
|
23
|
+
// ---- WebGL present by readback (docs/3d/RENDERERS.md) ----
|
|
24
|
+
// On a hardware GPU profile a WebGL canvas drawn from onSeek (outside requestAnimationFrame) is not always
|
|
25
|
+
// composited into the captured frame: on Windows it was captured empty, and drawImage of it kept showing frame 0,
|
|
26
|
+
// while gl.readPixels returned the right image. So there, after every seek, each WebGL canvas is read back with
|
|
27
|
+
// readPixels and shown through a 2D canvas laid exactly over it; the WebGL canvas keeps its place in the layout,
|
|
28
|
+
// invisible, so scripts keep their reference and nothing moves. A canvas opts in on any profile with
|
|
29
|
+
// data-mosio-present="readback" and out with data-mosio-present="compositor".
|
|
30
|
+
const glCanvases = new Map(); // canvas -> its WebGL context
|
|
31
|
+
const isGL = (t) => t === "webgl" || t === "webgl2" || t === "experimental-webgl";
|
|
32
|
+
// a page always has canvases; the SDK tests run this file in a bare context without them
|
|
33
|
+
const CanvasProto = typeof HTMLCanvasElement === "function" ? HTMLCanvasElement.prototype : null;
|
|
34
|
+
const realGetContext = CanvasProto ? CanvasProto.getContext : null;
|
|
35
|
+
const presentMode = (c) => { const a = c.getAttribute("data-mosio-present"); return a === "readback" || a === "compositor" ? a : (cfg.gpu ? "readback" : "compositor"); };
|
|
36
|
+
if (CanvasProto) CanvasProto.getContext = function getContext(type, attrs) {
|
|
37
|
+
// readback after the seek reads the drawing buffer that onSeek left: it must not be cleared by a composite first
|
|
38
|
+
if (isGL(type) && presentMode(this) === "readback") attrs = Object.assign({}, attrs, { preserveDrawingBuffer: true });
|
|
39
|
+
const ctx = realGetContext.call(this, type, attrs);
|
|
40
|
+
if (ctx && isGL(type)) glCanvases.set(this, ctx);
|
|
41
|
+
return ctx;
|
|
42
|
+
};
|
|
43
|
+
const mirrors = new WeakMap();
|
|
44
|
+
const MIRROR_STYLE = ["opacity", "filter", "mixBlendMode", "zIndex", "transform", "transformOrigin", "clipPath", "imageRendering",
|
|
45
|
+
"backgroundColor", "backgroundImage", "backgroundSize", "backgroundPosition", "backgroundRepeat", "backgroundClip", "backgroundOrigin",
|
|
46
|
+
"paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius",
|
|
47
|
+
...["Top", "Right", "Bottom", "Left"].flatMap((k) => ["border" + k + "Width", "border" + k + "Style", "border" + k + "Color"])];
|
|
48
|
+
function presentGL() {
|
|
49
|
+
for (const [c, gl] of glCanvases) {
|
|
50
|
+
let m = mirrors.get(c);
|
|
51
|
+
if (presentMode(c) !== "readback" || !c.isConnected) { if (m) m.style.display = "none"; continue; }
|
|
52
|
+
if (gl.isContextLost()) continue;
|
|
53
|
+
if (!m) {
|
|
54
|
+
m = document.createElement("canvas");
|
|
55
|
+
m.setAttribute("data-mosio-mirror", "");
|
|
56
|
+
m.setAttribute("aria-hidden", "true");
|
|
57
|
+
mirrors.set(c, m);
|
|
58
|
+
}
|
|
59
|
+
if (m.previousSibling !== c || m.parentNode !== c.parentNode) c.after(m);
|
|
60
|
+
const cs = getComputedStyle(c);
|
|
61
|
+
// the 2D canvas takes the WebGL canvas's border box in its containing block, with its border, padding,
|
|
62
|
+
// background and visual effects; its content box gets the pixels
|
|
63
|
+
const px = (k) => parseFloat(cs[k]) || 0;
|
|
64
|
+
const w = c.clientWidth - px("paddingLeft") - px("paddingRight"), h = c.clientHeight - px("paddingTop") - px("paddingBottom");
|
|
65
|
+
const st = m.style, fixed = cs.position === "fixed", r = fixed ? c.getBoundingClientRect() : null;
|
|
66
|
+
st.position = fixed ? "fixed" : "absolute";
|
|
67
|
+
st.left = (fixed ? r.left : c.offsetLeft) + "px";
|
|
68
|
+
st.top = (fixed ? r.top : c.offsetTop) + "px";
|
|
69
|
+
st.boxSizing = "content-box";
|
|
70
|
+
st.width = Math.max(0, w) + "px"; st.height = Math.max(0, h) + "px";
|
|
71
|
+
st.margin = "0"; st.pointerEvents = "none";
|
|
72
|
+
st.display = cs.display === "none" ? "none" : "block";
|
|
73
|
+
st.visibility = "visible";
|
|
74
|
+
for (const k of MIRROR_STYLE) st[k] = cs[k];
|
|
75
|
+
if (cs.position === "static") st.zIndex = "auto";
|
|
76
|
+
c.style.setProperty("visibility", "hidden", "important");
|
|
77
|
+
const dw = gl.drawingBufferWidth, dh = gl.drawingBufferHeight;
|
|
78
|
+
if (!dw || !dh) continue;
|
|
79
|
+
if (m.width !== dw) m.width = dw;
|
|
80
|
+
if (m.height !== dh) m.height = dh;
|
|
81
|
+
const buf = new Uint8Array(dw * dh * 4);
|
|
82
|
+
// read the default framebuffer whatever the scene left bound (a render target, a WebGL 2 pack buffer)
|
|
83
|
+
const fb = gl.getParameter(gl.FRAMEBUFFER_BINDING), gl2 = typeof WebGL2RenderingContext !== "undefined" && gl instanceof WebGL2RenderingContext;
|
|
84
|
+
const pack = gl2 ? gl.getParameter(gl.PIXEL_PACK_BUFFER_BINDING) : null;
|
|
85
|
+
if (fb) gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
86
|
+
if (pack) gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
|
|
87
|
+
gl.readPixels(0, 0, dw, dh, gl.RGBA, gl.UNSIGNED_BYTE, buf);
|
|
88
|
+
if (fb) gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
|
|
89
|
+
if (pack) gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pack);
|
|
90
|
+
const img = new ImageData(dw, dh), out = img.data, row = dw * 4;
|
|
91
|
+
for (let y = 0; y < dh; y++) out.set(buf.subarray((dh - 1 - y) * row, (dh - y) * row), y * row);
|
|
92
|
+
const at = gl.getContextAttributes() || {};
|
|
93
|
+
if (at.alpha && at.premultipliedAlpha !== false) {
|
|
94
|
+
// the drawing buffer is premultiplied, ImageData is not
|
|
95
|
+
for (let i = 0; i < out.length; i += 4) { const a = out[i + 3]; if (a && a < 255) { out[i] = Math.min(255, Math.round(out[i] * 255 / a)); out[i + 1] = Math.min(255, Math.round(out[i + 1] * 255 / a)); out[i + 2] = Math.min(255, Math.round(out[i + 2] * 255 / a)); } }
|
|
96
|
+
}
|
|
97
|
+
realGetContext.call(m, "2d").putImageData(img, 0, 0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
23
101
|
// ---- seeded PRNG (mulberry32) replaces Math.random ----
|
|
24
102
|
let s = cfg.seed >>> 0;
|
|
25
103
|
const random = () => { s = (s + 0x6D2B79F5) >>> 0; let x = s; x = Math.imul(x ^ (x >>> 15), x | 1);
|
|
@@ -116,6 +194,7 @@
|
|
|
116
194
|
|
|
117
195
|
// ---- adapters ----
|
|
118
196
|
const timelines = []; // GSAP (optional library)
|
|
197
|
+
let blurCfg = null; // __mosio.motionBlur: read by the driver after load
|
|
119
198
|
const seekFns = []; // explicit __mosio.onSeek
|
|
120
199
|
const births = new WeakMap(); // WAAPI/CSS animation -> virtual ms when first seen
|
|
121
200
|
const handles = new Map(); // delayFrame label -> pending
|
|
@@ -224,6 +303,7 @@
|
|
|
224
303
|
if (before) await before();
|
|
225
304
|
if (live) seekVideosLive(t); // non-blocking: no exact frame is promised
|
|
226
305
|
else if (!replay) await seekVideos(t); // a replayed frame is never captured: its video position is set by the next real frame
|
|
306
|
+
const video = !replay && document.querySelector("video") !== null;
|
|
227
307
|
while (handles.size) await new Promise((r) => realSetTimeout(r, 5));
|
|
228
308
|
await document.fonts.ready;
|
|
229
309
|
for (const f of document.fonts) if (f.status === "error") return { ok: false, code: "E_FONT_LOAD", detail: f.family + " " + f.weight };
|
|
@@ -243,8 +323,12 @@
|
|
|
243
323
|
// one style/layout, then drain queued tasks (animation events etc.) so the next BeginFrame sees settled state.
|
|
244
324
|
// Frames are produced by HeadlessExperimental.beginFrame from the driver, never by the wall clock.
|
|
245
325
|
document.documentElement.getBoundingClientRect();
|
|
246
|
-
|
|
247
|
-
|
|
326
|
+
presentGL();
|
|
327
|
+
// `cfg.barrierDrains` (default 3): the canvas capture measures fewer (docs/design/fast-path.md)
|
|
328
|
+
for (let i = 0; i < (cfg.barrierDrains ?? 3); i++) await new Promise((r) => realSetTimeout(r, 0));
|
|
329
|
+
// a <video> frame reaches the compositor on its own schedule after `seeked`: the driver never trusts a
|
|
330
|
+
// no-damage probe for such a frame (it could keep the previous picture), it always captures
|
|
331
|
+
return { ok: true, video };
|
|
248
332
|
})();
|
|
249
333
|
let timer;
|
|
250
334
|
const timeout = new Promise((r) => { timer = realSetTimeout(() => r({ ok: false, code: "E_BARRIER_TIMEOUT", pending: pendingList() }), cfg.timeoutMs); });
|
|
@@ -949,7 +1033,36 @@
|
|
|
949
1033
|
if (res.flat) return "matrix(" + [m[0], m[1], m[4], m[5], m[12], m[13]].map(f).join(",") + ")";
|
|
950
1034
|
return "matrix3d(" + m.map(f).join(",") + ")";
|
|
951
1035
|
}
|
|
952
|
-
|
|
1036
|
+
// ---- describe: the plan as plain data for `mosio inspect` (docs/CLI.md "Camera checks"): the main shots, the holds
|
|
1037
|
+
// (a tour stop, or the time a single-target shot rests on its target until the next shot) and the overlays. The
|
|
1038
|
+
// numbers are the ones the solver runs on, so the checks never re-derive a timeline of their own.
|
|
1039
|
+
function describe(plan, env) {
|
|
1040
|
+
const real = (a) => a.filter((x) => x !== "stage");
|
|
1041
|
+
const chars = (ids) => (env && env.textLen ? env.textLen(ids) : 0);
|
|
1042
|
+
const mains = plan.mains.map((m) => ({
|
|
1043
|
+
index: m.index, kind: m.kind, at: m.at, dur: m.dur, confine: m.confine !== false,
|
|
1044
|
+
fit: m.framing && isNum(m.framing.fit) ? m.framing.fit : null, offset: m.framing ? m.framing.offset.slice() : [0, 0],
|
|
1045
|
+
stops: m.stops ? m.stops.map((s, k) => ({ start: m.at + m.starts[k], move: m.move[k], hold: m.hold[k], ids: real(s) })) : null,
|
|
1046
|
+
}));
|
|
1047
|
+
const holds = [];
|
|
1048
|
+
plan.mains.forEach((m, i) => {
|
|
1049
|
+
const next = plan.mains[i + 1];
|
|
1050
|
+
if (m.kind === "tour") {
|
|
1051
|
+
m.stops.forEach((s, k) => { const ids = real(s), from = m.at + m.starts[k] + m.move[k]; if (ids.length) holds.push({ shot: m.index, kind: m.kind, stop: k, from, to: from + m.hold[k], ids, chars: chars(ids) }); });
|
|
1052
|
+
} else if (["zoom-in", "zoom-out", "reveal", "earth-zoom", "pan"].includes(m.kind)) {
|
|
1053
|
+
const ids = real(m.to || []);
|
|
1054
|
+
if (ids.length) holds.push({ shot: m.index, kind: m.kind, stop: null, from: m.at + m.dur, to: next ? next.at : null, ids, chars: chars(ids) });
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
const fin = (d) => (Number.isFinite(d) ? d : null);
|
|
1058
|
+
return {
|
|
1059
|
+
w: plan.W, h: plan.H, sw: plan.SW, sh: plan.SH, end: plan.end, mains, holds,
|
|
1060
|
+
shakes: plan.overlays.filter((o) => o.kind === "shake").map((o) => ({ index: o.index, at: o.at, dur: o.dur })),
|
|
1061
|
+
parallax: plan.parallax.map((p) => ({ index: p.index, at: p.at, dur: fin(p.dur), strength: p.strength })),
|
|
1062
|
+
handheld: plan.overlays.filter((o) => o.kind === "handheld").map((o) => ({ index: o.index, at: o.at, dur: fin(o.dur) })),
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
return { CamErr, build, solve, css, ease, vanWijk, holdFor, fbm, vnoise, overlayAt, mainState, dampedState, confineState, frameOf, mix, h32, describe };
|
|
953
1066
|
})();
|
|
954
1067
|
|
|
955
1068
|
// ---- camera: page glue. One `application/mosio-camera` block per scene; <body> is the stage root. ----
|
|
@@ -1003,12 +1116,14 @@
|
|
|
1003
1116
|
document.body.style.transformOrigin = "0 0";
|
|
1004
1117
|
} catch (e) { camera = null; camFail(e); }
|
|
1005
1118
|
}
|
|
1119
|
+
let camOff = false; // the Studio's camera view films the stage without the camera (preview only)
|
|
1006
1120
|
function cameraApply(sec) {
|
|
1007
1121
|
if (!camera) return;
|
|
1008
1122
|
const body = document.body;
|
|
1009
1123
|
try {
|
|
1010
1124
|
camRects = new Map();
|
|
1011
1125
|
body.style.transform = "none"; body.style.filter = "";
|
|
1126
|
+
if (camOff) { for (const o of camDepth) if (o.on) { o.el.style.translate = ""; o.on = false; } return; }
|
|
1012
1127
|
const b = body.getBoundingClientRect();
|
|
1013
1128
|
const res = CAM.solve(camera, camEnv, sec);
|
|
1014
1129
|
body.style.transform = CAM.css(res, b.left, b.top);
|
|
@@ -1020,6 +1135,39 @@
|
|
|
1020
1135
|
} catch (e) { body.style.transform = ""; camFail(e); }
|
|
1021
1136
|
}
|
|
1022
1137
|
|
|
1138
|
+
// The camera and the text in the stage's own coordinates at frame time `sec`, for the inspect checks. Measures with the
|
|
1139
|
+
// camera transform off (as cameraApply does) and puts it back, so the frame is untouched.
|
|
1140
|
+
function cameraSample(sec) {
|
|
1141
|
+
const body = document.body, keep = body.style.transform;
|
|
1142
|
+
try {
|
|
1143
|
+
body.style.transform = "none";
|
|
1144
|
+
const res = CAM.solve(camera, camEnv, sec), st = res.state, texts = [];
|
|
1145
|
+
const rg = document.createRange();
|
|
1146
|
+
for (const el of document.querySelectorAll("[data-mosio-id]")) {
|
|
1147
|
+
if (el.closest("script,style,template,noscript")) continue;
|
|
1148
|
+
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity, n = 0;
|
|
1149
|
+
for (const c of el.childNodes) {
|
|
1150
|
+
if (c.nodeType !== 3 || !c.nodeValue.trim()) continue;
|
|
1151
|
+
rg.selectNodeContents(c);
|
|
1152
|
+
const b = rg.getBoundingClientRect();
|
|
1153
|
+
if (!(b.width > 0 && b.height > 0)) continue;
|
|
1154
|
+
x0 = Math.min(x0, b.left); y0 = Math.min(y0, b.top); x1 = Math.max(x1, b.right); y1 = Math.max(y1, b.bottom);
|
|
1155
|
+
n += Array.from(c.nodeValue.replace(/\s+/g, " ").trim()).length;
|
|
1156
|
+
}
|
|
1157
|
+
if (!n) continue;
|
|
1158
|
+
let op = 1;
|
|
1159
|
+
for (let e = el; e && e.nodeType === 1; e = e.parentElement) { const cs = getComputedStyle(e); if (cs.display === "none" || cs.visibility === "hidden") { op = 0; break; } op *= +cs.opacity; }
|
|
1160
|
+
const dep = el.closest("[data-mosio-depth]"), inside = [];
|
|
1161
|
+
for (let e = el; e; e = e.parentElement) { const id = e.getAttribute && e.getAttribute("data-mosio-id"); if (id) inside.push(id); }
|
|
1162
|
+
texts.push({ id: el.getAttribute("data-mosio-id"), inside, r: [x0, y0, x1 - x0, y1 - y0], chars: n, fs: parseFloat(getComputedStyle(el).fontSize) || 0, op, depth: dep ? +dep.getAttribute("data-mosio-depth") || 0 : 0 });
|
|
1163
|
+
}
|
|
1164
|
+
const layers = [];
|
|
1165
|
+
if (res.parallax) for (const o of camDepth) { const b = o.el.getBoundingClientRect(); if (o.d && b.width > 0 && b.height > 0) layers.push({ r: [b.left, b.top, b.width, b.height], depth: o.d }); }
|
|
1166
|
+
return { t: sec, z: st.z, cx: st.cx, cy: st.cy, yaw: st.yaw || 0, pitch: st.pitch || 0, sx: res.shake.dx, sy: res.shake.dy, rot: res.shake.rot,
|
|
1167
|
+
par: res.parallax ? { k: res.parallax.k, dx: res.parallax.dx, dy: res.parallax.dy } : null, texts, layers };
|
|
1168
|
+
} finally { body.style.transform = keep; }
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1023
1171
|
window.__mosio = {
|
|
1024
1172
|
get fps() { return fps; }, get frame() { return frame; }, get time() { return vt / 1000; }, get seed() { return cfg.seed >>> 0; },
|
|
1025
1173
|
// the project's params this scene reads (mosio.json `params`, limited by `scenes[].reads.params`); read-only
|
|
@@ -1032,6 +1180,38 @@
|
|
|
1032
1180
|
onSeek(fn) { if (typeof fn === "function") { seekFns.push(fn); try { fn(vt / 1000, frame); } catch (e) { errors.push(String(e && e.stack || e)); } } },
|
|
1033
1181
|
at,
|
|
1034
1182
|
_camera: CAM,
|
|
1183
|
+
// for `mosio inspect`: the camera plan as data, and the camera and the measured text at one frame time (null without a camera)
|
|
1184
|
+
_cameraPlan() { return camera ? CAM.describe(camera, camEnv) : null; },
|
|
1185
|
+
_cameraSample(sec) { return camera ? cameraSample(sec) : null; },
|
|
1186
|
+
// preview only (the Studio's camera view): the scene's plan and how it measures targets, and filming without it
|
|
1187
|
+
get _cameraRig() { return camera ? { plan: camera, env: camEnv } : null; },
|
|
1188
|
+
_cameraBypass(on) { camOff = !!on; cameraApply(vt / 1000); },
|
|
1189
|
+
// Motion blur: every captured frame becomes the average of `samples` instants spread over the `shutter` share of
|
|
1190
|
+
// the frame before it (0.5 = a 180-degree film shutter), so fast moves smear like a camera sees them. `ranges`
|
|
1191
|
+
// (scene seconds, [[from, to], ...]) limits it to the fast parts; a still frame costs the same with or without.
|
|
1192
|
+
// Called once by the scene script; the driver reads it after load.
|
|
1193
|
+
motionBlur(o) {
|
|
1194
|
+
const v = Object.assign({ samples: 8, shutter: 0.5, ranges: null }, o || {});
|
|
1195
|
+
if (!Number.isInteger(v.samples) || v.samples < 2 || v.samples > 32) throw new TypeError("E_MOTION_BLUR: samples must be a whole number from 2 to 32");
|
|
1196
|
+
if (!(typeof v.shutter === "number" && v.shutter > 0 && v.shutter <= 1)) throw new TypeError("E_MOTION_BLUR: shutter must be a number in (0, 1]");
|
|
1197
|
+
if (v.ranges != null && !(Array.isArray(v.ranges) && v.ranges.every((r) => Array.isArray(r) && r.length === 2 && r.every(Number.isFinite) && r[0] <= r[1])))
|
|
1198
|
+
throw new TypeError("E_MOTION_BLUR: ranges must be [[from, to], ...] in seconds");
|
|
1199
|
+
blurCfg = { samples: v.samples, shutter: v.shutter, ranges: v.ranges };
|
|
1200
|
+
return blurCfg;
|
|
1201
|
+
},
|
|
1202
|
+
_blur() { return blurCfg; },
|
|
1203
|
+
// The shutter of frame f, for every capture path (screenshots in the driver, drawElementImage on the canvas path):
|
|
1204
|
+
// null when f is not blurred, else the sub-frame positions before f, earliest first (f itself is the last sample).
|
|
1205
|
+
// A path takes subs[0] and f first and keeps f alone when both images are identical; otherwise the frame is the
|
|
1206
|
+
// mean of all samples (integer sum, rounded half up).
|
|
1207
|
+
_blurPlan(f) {
|
|
1208
|
+
if (!blurCfg) return null;
|
|
1209
|
+
const t = f / fps, n = blurCfg.samples, sh = blurCfg.shutter;
|
|
1210
|
+
if (blurCfg.ranges && !blurCfg.ranges.some((r) => t >= r[0] && t <= r[1])) return null;
|
|
1211
|
+
const subs = [];
|
|
1212
|
+
for (let k = n - 1; k >= 1; k--) subs.push(Math.max(0, f - (sh * k) / n));
|
|
1213
|
+
return { samples: n, shutter: sh, subs };
|
|
1214
|
+
},
|
|
1035
1215
|
delayFrame(label) { const l = String(label || "handle-" + handles.size); handles.set(l, true); return { done() { handles.delete(l); } }; },
|
|
1036
1216
|
|
|
1037
1217
|
// ---- called by the Rust driver ----
|
|
@@ -1062,7 +1242,9 @@
|
|
|
1062
1242
|
const replay = o.replay === true, live = o.live === true && !replay;
|
|
1063
1243
|
// async work started earlier (delayFrame) must finish before time is applied, or a draw can run without it
|
|
1064
1244
|
for (let waited = 0; handles.size && waited < cfg.timeoutMs; waited += 5) await new Promise((res) => realSetTimeout(res, 5));
|
|
1065
|
-
frame
|
|
1245
|
+
// a motion-blur sub-frame has a fractional f: time follows it exactly, frame-indexed content (renders, onSeek's
|
|
1246
|
+
// frame argument) stays on the whole frame it belongs to
|
|
1247
|
+
frame = Math.floor(f);
|
|
1066
1248
|
if (!live) { lastLive = null; pauseVideos(); } // exact and replay frames never leave a video playing
|
|
1067
1249
|
const t = (f * 1000) / fps;
|
|
1068
1250
|
lastVt = vt;
|
|
@@ -1070,12 +1252,29 @@
|
|
|
1070
1252
|
flushRAF();
|
|
1071
1253
|
for (const tl of timelines) seekTl(tl, t / 1000);
|
|
1072
1254
|
applyClips(t);
|
|
1073
|
-
applyRenders(
|
|
1255
|
+
applyRenders(frame);
|
|
1074
1256
|
applyAnimations(t);
|
|
1075
|
-
for (const fn of seekFns) { try { fn(t / 1000,
|
|
1257
|
+
for (const fn of seekFns) { try { fn(t / 1000, frame); } catch (e) { errors.push(String(e && e.stack || e)); } }
|
|
1076
1258
|
cameraApply(t / 1000);
|
|
1077
1259
|
const r = await barrier(t, undefined, replay, live);
|
|
1078
1260
|
return result(r);
|
|
1079
1261
|
},
|
|
1262
|
+
// Frames before `start` at which a GSAP tween starts (each start's floor and ceil frame). A page that skips the
|
|
1263
|
+
// replay seeks these in order before `start`: GSAP records per-tween state when a tween first renders (SVG
|
|
1264
|
+
// transform-origin offsets, from-values), and that state depends on the frame it first rendered at. Every frame
|
|
1265
|
+
// here is one a sequential render also visits, so the tweens initialise at the same frames as a render from 0.
|
|
1266
|
+
_warmFrames(start) {
|
|
1267
|
+
const out = new Set();
|
|
1268
|
+
const walk = (tl, off, scale) => {
|
|
1269
|
+
if (typeof tl.getChildren !== "function") return;
|
|
1270
|
+
for (const c of tl.getChildren(false, true, true)) {
|
|
1271
|
+
const s = off + c.startTime() / (scale || 1);
|
|
1272
|
+
if (typeof c.getChildren === "function") walk(c, s, c.timeScale());
|
|
1273
|
+
else for (const f of [Math.floor(s * fps), Math.ceil(s * fps)]) if (f > 0 && f < start) out.add(f);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
for (const tl of timelines) walk(tl, 0, 1);
|
|
1277
|
+
return Array.from(out).sort((a, b) => a - b);
|
|
1278
|
+
},
|
|
1080
1279
|
};
|
|
1081
1280
|
})();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mosio": 1,
|
|
3
|
+
"name": "camera-inspect",
|
|
4
|
+
"description": "Camera readability checks of mosio inspect: one clean scene (good) and one scene per W_CAMERA_* check.",
|
|
5
|
+
"width": 640,
|
|
6
|
+
"height": 360,
|
|
7
|
+
"fps": 30,
|
|
8
|
+
"seed": 3,
|
|
9
|
+
"background": "#101828",
|
|
10
|
+
"scenes": [
|
|
11
|
+
{
|
|
12
|
+
"id": "good",
|
|
13
|
+
"src": "scenes/good.html",
|
|
14
|
+
"frames": 150
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "read",
|
|
18
|
+
"src": "scenes/read.html",
|
|
19
|
+
"frames": 150
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "cut",
|
|
23
|
+
"src": "scenes/cut.html",
|
|
24
|
+
"frames": 150
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "speed",
|
|
28
|
+
"src": "scenes/speed.html",
|
|
29
|
+
"frames": 90
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "behind",
|
|
33
|
+
"src": "scenes/behind.html",
|
|
34
|
+
"frames": 150
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "shake",
|
|
38
|
+
"src": "scenes/shake.html",
|
|
39
|
+
"frames": 180
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "edges",
|
|
43
|
+
"src": "scenes/edges.html",
|
|
44
|
+
"frames": 120
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"output": {
|
|
48
|
+
"default": {
|
|
49
|
+
"codec": "h264",
|
|
50
|
+
"crf": 28,
|
|
51
|
+
"preset": "ultrafast",
|
|
52
|
+
"pix_fmt": "yuv420p",
|
|
53
|
+
"gop_frames": 30
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div data-mosio-depth="1" style="position:absolute;left:-60px;top:-60px;width:760px;height:480px;background:repeating-linear-gradient(90deg,#1b2a47 0 40px,#101828 40px 80px)"></div>
|
|
14
|
+
<div class="box" style="left:380px;top:170px;width:120px;height:24px;padding:4px;background:#e63946" data-mosio-id="cap">Moving backdrop</div>
|
|
15
|
+
<script type="application/mosio-camera">
|
|
16
|
+
[
|
|
17
|
+
{ "shot": "zoom-in", "to": "cap", "fit": 0.5, "dur": 3 },
|
|
18
|
+
{ "shot": "parallax", "strength": 0.5 }
|
|
19
|
+
]
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:125px;top:65px;background:#e63946" data-mosio-id="step-1">Cut by the frame edge</div>
|
|
14
|
+
<script type="application/mosio-camera">
|
|
15
|
+
[ { "shot": "zoom-in", "to": "step-1", "fit": 1.6, "dur": 2.5 } ]
|
|
16
|
+
</script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box lbl" style="left:10px;top:10px;width:100px;height:40px" data-mosio-id="lbl">Top left</div>
|
|
14
|
+
<script type="application/mosio-camera">
|
|
15
|
+
[ { "shot": "zoom-in", "to": "lbl", "fit": 0.5, "dur": 2.5, "confine": false } ]
|
|
16
|
+
</script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:125px;top:65px;background:#e63946" data-mosio-id="step-1">1. Collect</div>
|
|
14
|
+
<div class="box step" style="left:365px;top:135px;background:#2a9d8f" data-mosio-id="step-2">2. Check it</div>
|
|
15
|
+
<script type="application/mosio-camera">
|
|
16
|
+
{ "feel": "calm",
|
|
17
|
+
"shots": [
|
|
18
|
+
{ "shot": "tour", "targets": ["#step-1", "#step-2"], "move": 1.6, "fit": 0.5, "hold": "auto" },
|
|
19
|
+
{ "shot": "shake", "at": 4.2, "preset": "bump" }
|
|
20
|
+
] }
|
|
21
|
+
</script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:125px;top:65px;background:#e63946" data-mosio-id="step-1">1. Collect</div>
|
|
14
|
+
<div class="box step" style="left:365px;top:135px;background:#2a9d8f" data-mosio-id="step-2">2. Clean the data, then check it against the source once more before you publish it</div>
|
|
15
|
+
<script type="application/mosio-camera">
|
|
16
|
+
{ "feel": "calm",
|
|
17
|
+
"shots": [
|
|
18
|
+
{ "shot": "tour", "targets": ["#step-1", "#step-2"], "move": 1.6, "fit": 0.5, "hold": [0.8, 1.0] }
|
|
19
|
+
] }
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box lbl" style="left:245px;top:160px;width:150px;height:40px" data-mosio-id="lbl">Hold on tight</div>
|
|
14
|
+
<script type="application/mosio-camera">
|
|
15
|
+
[
|
|
16
|
+
{ "shot": "zoom-in", "to": "lbl", "fit": 0.5, "dur": 1.6 },
|
|
17
|
+
{ "shot": "shake", "at": 2.0, "dur": 1.2 },
|
|
18
|
+
{ "shot": "shake", "at": 3.4, "preset": "bump" },
|
|
19
|
+
{ "shot": "shake", "at": 4.2, "preset": "bump" }
|
|
20
|
+
]
|
|
21
|
+
</script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 640px; height: 360px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:245px;top:135px;background:#e63946" data-mosio-id="lbl">Mind the gap</div>
|
|
14
|
+
<script type="application/mosio-camera">
|
|
15
|
+
[ { "shot": "zoom-in", "to": "lbl", "fit": 0.5, "dur": 0.4 } ]
|
|
16
|
+
</script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mosio": 1,
|
|
3
|
+
"name": "camera-inspect-vertical",
|
|
4
|
+
"description": "Camera safe-zone check of mosio inspect in a 9:16 film: a clean tour (good) and text parked in the top band (safe).",
|
|
5
|
+
"width": 360,
|
|
6
|
+
"height": 640,
|
|
7
|
+
"fps": 30,
|
|
8
|
+
"seed": 3,
|
|
9
|
+
"background": "#101828",
|
|
10
|
+
"scenes": [
|
|
11
|
+
{
|
|
12
|
+
"id": "good",
|
|
13
|
+
"src": "scenes/good.html",
|
|
14
|
+
"frames": 150
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "safe",
|
|
18
|
+
"src": "scenes/safe.html",
|
|
19
|
+
"frames": 120
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"output": {
|
|
23
|
+
"default": {
|
|
24
|
+
"codec": "h264",
|
|
25
|
+
"crf": 28,
|
|
26
|
+
"preset": "ultrafast",
|
|
27
|
+
"pix_fmt": "yuv420p",
|
|
28
|
+
"gop_frames": 30
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 360px; height: 640px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:105px;top:130px;background:#e63946" data-mosio-id="step-1">1. Collect</div>
|
|
14
|
+
<div class="box step" style="left:105px;top:360px;background:#2a9d8f" data-mosio-id="step-2">2. Check it</div>
|
|
15
|
+
<script type="application/mosio-camera">
|
|
16
|
+
{ "feel": "calm",
|
|
17
|
+
"shots": [ { "shot": "tour", "targets": ["#step-1", "#step-2"], "move": 1.6, "fit": 0.5, "hold": "auto" } ] }
|
|
18
|
+
</script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
html, body { margin: 0; width: 360px; height: 640px; background: #101828; overflow: hidden; font-family: sans-serif; }
|
|
7
|
+
.box { position: absolute; box-sizing: border-box; padding: 8px; color: #fff; font-size: 13px; line-height: 16px; border-radius: 8px; }
|
|
8
|
+
.step { width: 150px; min-height: 90px; }
|
|
9
|
+
.lbl { white-space: nowrap; background: #2a9d8f; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="box step" style="left:105px;top:20px;background:#e63946;min-height:40px" data-mosio-id="step-1">Up in the platform bar</div>
|
|
14
|
+
<script type="application/mosio-camera">
|
|
15
|
+
[ { "shot": "zoom-in", "to": "step-1", "fit": 0.5, "dur": 2 } ]
|
|
16
|
+
</script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mosio": 1,
|
|
3
|
+
"name": "cloudrun-gpu",
|
|
4
|
+
"description": "GPU image check: three.js on renderer.webgl gpu, a music bed ducked under a voice. Cloud Run job input.",
|
|
5
|
+
"width": 360,
|
|
6
|
+
"height": 640,
|
|
7
|
+
"fps": 30,
|
|
8
|
+
"seed": 7,
|
|
9
|
+
"background": "#0b0d12",
|
|
10
|
+
"libraries": ["three@0.187.0", "mosio-three@0.1.0"],
|
|
11
|
+
"assets": ["audio/music.wav", "audio/vo.wav"],
|
|
12
|
+
"scenes": [{ "id": "cube", "src": "scenes/cube.html", "frames": 45 }],
|
|
13
|
+
"tracks": [
|
|
14
|
+
{ "id": "music", "kind": "audio", "duck": { "under": "vo" }, "clips": [{ "id": "bed", "src": "audio/music.wav", "start": 0, "frames": 45 }] },
|
|
15
|
+
{ "id": "vo", "kind": "audio", "clips": [{ "id": "line", "src": "audio/vo.wav", "start": 12, "frames": 18 }] }
|
|
16
|
+
],
|
|
17
|
+
"renderer": { "webgl": "gpu" }
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html><head><meta charset="utf-8"><title>cube</title>
|
|
3
|
+
<script type="importmap">{"imports":{"three":"/_lib/three@0.187.0/build/three.module.js","three/addons/":"/_lib/three@0.187.0/examples/jsm/"}}</script>
|
|
4
|
+
<style>html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #0b0d12; } canvas#c { position: absolute; inset: 0; display: block; }</style>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<canvas id="c" data-mosio-id="cube/canvas"></canvas>
|
|
8
|
+
<script type="module">
|
|
9
|
+
import * as THREE from "three";
|
|
10
|
+
import { createStage } from "/_lib/mosio-three@0.1.0/mosio-three.js";
|
|
11
|
+
await createStage({
|
|
12
|
+
THREE, canvas: document.getElementById("c"), backend: "webgl", background: "#0b0d12", fov: 35,
|
|
13
|
+
async setup(ctx) {
|
|
14
|
+
ctx.cube = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.3, 0.3), new THREE.MeshStandardMaterial({ color: "#4f8cff", roughness: 0.35, metalness: 0.1 }));
|
|
15
|
+
ctx.scene.add(ctx.id(ctx.cube, "stage/cube"));
|
|
16
|
+
const key = new THREE.DirectionalLight("#ffffff", 2.2); key.position.set(-0.5, 0.8, 0.6); ctx.scene.add(ctx.id(key, "light/key"));
|
|
17
|
+
ctx.scene.add(ctx.id(new THREE.HemisphereLight("#dfe8ff", "#1a1410", 0.6), "light/ambient"));
|
|
18
|
+
},
|
|
19
|
+
update(t, frame, ctx) {
|
|
20
|
+
ctx.cube.rotation.set(t * 1.1, t * 1.7, 0);
|
|
21
|
+
ctx.camera.position.set(0, 0, 1.4); ctx.camera.lookAt(0, 0, 0);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
</body></html>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{ "mosio": 0, "name": "direct-seek", "description": "Single frames that seek straight to the frame: pure (no seek field, --direct), meta (\"seek\": \"direct\"), clock (\"seek\": \"direct\" but stateful, so it replays), slow (heavy frames: a long replay reports progress on stderr).",
|
|
2
|
+
"width": 320, "height": 180, "fps": 30, "seed": 0, "background": "#102030", "libraries": [], "shared": [], "assets": [],
|
|
3
|
+
"scenes": [ { "id": "pure", "src": "scenes/pure.html", "frames": 300 }, { "id": "meta", "src": "scenes/meta.html", "frames": 300, "seek": "direct" },
|
|
4
|
+
{ "id": "clock", "src": "scenes/clock.html", "frames": 60, "seek": "direct" }, { "id": "slow", "src": "scenes/slow.html", "frames": 200 } ], "transitions": [], "audio": [] }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<!doctype html><html><head><meta charset="utf-8"><style>* { margin: 0; padding: 0; } html, body { width: 320px; height: 180px; overflow: hidden; background: #102030; } #b { position: absolute; top: 70px; width: 40px; height: 40px; background: #f59e0b; }</style></head>
|
|
2
|
+
<body><div id="b" data-mosio-id="clock/box"></div>
|
|
3
|
+
<script>
|
|
4
|
+
// rAF + performance.now after load: the picture depends on the frames before it, so a direct seek must fall back
|
|
5
|
+
// to replaying from frame 0 even though mosio.json says "seek": "direct".
|
|
6
|
+
let x = 0;
|
|
7
|
+
function tick() { x = (x + 3) % 280; document.getElementById("b").style.left = x + "px"; requestAnimationFrame(tick); }
|
|
8
|
+
requestAnimationFrame(tick);
|
|
9
|
+
</script></body></html>
|