Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/thatdeveloperguy-website / tools/rive-harness/harness.html |
| Date | Not specified in source |
| Repository | Janady13/thatdeveloperguy-website |
| Revision | 2bea2ebdff0e34494bff597d4fa9c8422a0c3a94 |
| Branch | main |
| Path or archive member | tools/rive-harness/harness.html |
| Original SHA-256 | cfaa0b0743546668d247421b781717c25c1feb0d2f62eae65760d9fabae81653 |
| Git blob SHA | 2b0015ca3a85040aaa4e5def1a59a330c7088d8c |
| Reading-copy SHA-256 | cfaa0b0743546668d247421b781717c25c1feb0d2f62eae65760d9fabae81653 |
Recovered source transcript
Download complete source text ↓29 lines · 2.4 KB
<!doctype html><html><head><meta charset="utf-8"><title>Rive proof harness</title>
<style>html,body{margin:0;background:#fff}canvas{display:block;width:1648px;height:928px}</style>
<script src="/runtime/rive.js"></script></head>
<body><canvas id="c" width="1648" height="928"></canvas>
<script>
// Drives the pinned @rive-app/webgl2 runtime exactly as the site does (state machine + autoBind view model), exposing captures to the proof script.
rive.RuntimeLoader.setWasmUrl('/runtime/rive.wasm');
const params = new URLSearchParams(location.search);
const canvas = document.getElementById('c');
window.__proof = { loaded: false, error: null, frames: 0 };
const sm = params.get('sm');
const r = new rive.Rive({
src: params.get('src'), canvas, artboard: params.get('artboard'), ...(sm ? { stateMachines: sm, autoBind: true } : {}), autoplay: true, enableRiveAssetCDN: false,
layout: new rive.Layout({ fit: rive.Fit.Contain, alignment: rive.Alignment.Center }),
onLoad: () => { window.__proof.loaded = true; window.__proof.rive = r; window.__proof.artboards = r.contents?.artboards?.map(a => ({ name: a.name, animations: a.animations, stateMachines: a.stateMachines?.map(s => s.name) })); },
onLoadError: e => { window.__proof.error = String(e?.data ?? e); },
onAdvance: () => { window.__proof.frames++; },
});
window.__proof.capture = () => canvas.toDataURL('image/png');
window.__proof.setEnum = (name, value) => { const p = r.viewModelInstance?.enum(name); if (!p) throw new Error('no enum ' + name); p.value = value; return p.value; };
window.__proof.setBool = (name, value) => { const p = r.viewModelInstance?.boolean(name); if (!p) throw new Error('no boolean ' + name); p.value = value; return p.value; };
window.__proof.setNumber = (name, value) => { const p = r.viewModelInstance?.number(name); if (!p) throw new Error('no number ' + name); p.value = value; return p.value; };
window.__proof.fire = name => { const p = r.viewModelInstance?.trigger(name); if (!p) throw new Error('no trigger ' + name); p.trigger(); return true; };
window.__proof.play = names => { r.stop(); r.play(names); return r.playingAnimationNames; };
window.__proof.playAlso = names => { r.play(names); return r.playingAnimationNames; };
window.__proof.stop = names => { r.stop(names); return r.playingAnimationNames; };
window.__proof.vm = () => r.viewModelInstance ? { name: r.viewModelInstance.name ?? null, ok: true } : { ok: false };
</script></body></html>