| 25 | // that one is module-private; this is ~15 lines and sharing it would mean |
| 26 | // touching motionShot.ts (out of scope for this change). |
| 27 | function orbitStageSource(): string { |
| 28 | return `function(cam) { |
| 29 | var root = document.querySelector("[data-composition-id]") |
| 30 | || document.querySelector("#stage") |
| 31 | || document.body.firstElementChild |
| 32 | || document.body; |
| 33 | var n = root; |
| 34 | while (n && n !== document.body) { |
| 35 | n.style.transformStyle = "preserve-3d"; |
| 36 | n.style.perspective = "none"; |
| 37 | n = n.parentElement; |
| 38 | } |
| 39 | root.style.transformStyle = "preserve-3d"; |
| 40 | root.style.perspective = "none"; |
| 41 | root.style.transformOrigin = "50% 50%"; |
| 42 | root.style.transform = "rotateX(" + cam.pitch + "deg) rotateY(" + cam.yaw + "deg)"; |
| 43 | var lens = root.parentElement || document.body; |
| 44 | lens.style.perspective = "1600px"; |
| 45 | lens.style.perspectiveOrigin = "50% 50%"; |
| 46 | }`; |
| 47 | } |
| 48 | |
| 49 | /** Maximum time a single-frame FFmpeg extract is allowed to run. Mirrors the |
| 50 | * default applied by `@hyperframes/engine`'s `runFfmpeg` so a pathological |