Let the recorder capture what you are doing rather than only what the tour does, and letterbox the preview so the framing you compose is the framing you get.
This commit is contained in:
parent
fe2520d620
commit
4a037ba816
3 changed files with 88 additions and 10 deletions
11
PROGRESS.md
11
PROGRESS.md
|
|
@ -13,7 +13,8 @@ viewer is live at <https://medieval.crt.fyi/> and rebuilds on every push. The
|
||||||
GitHub repository is private, which is deliberate, and which is why the npm
|
GitHub repository is private, which is deliberate, and which is why the npm
|
||||||
page's Repository and Issues links 404 until that changes.
|
page's Repository and Issues links 404 until that changes.
|
||||||
|
|
||||||
**`@contemporary-props`** is six models into a planned 119. Present-day objects,
|
**`@contemporary-props`** is six models into a core hundred, with a further
|
||||||
|
150 catalogued behind them. Present-day objects,
|
||||||
no lowpoly budget, no historical constraint. 19 material slots. Nothing is
|
no lowpoly budget, no historical constraint. 19 material slots. Nothing is
|
||||||
published and the version is `0.0.0`.
|
published and the version is `0.0.0`.
|
||||||
|
|
||||||
|
|
@ -303,8 +304,12 @@ asking GitHub Support to purge actually closes it.
|
||||||
|
|
||||||
## Open
|
## Open
|
||||||
|
|
||||||
- **`contemporary-props`**: 6 of 119 modelled. The catalogue, the build order,
|
- **`contemporary-props`**: 6 of the core 100 modelled, and they are rows 1 to
|
||||||
the cuts and the slot argument are in `contemporary-props/CATALOGUE.md`.
|
6 of the build order rather than six picked at random. The catalogue, the
|
||||||
|
order, the cuts and the slot argument are in
|
||||||
|
`contemporary-props/CATALOGUE.md`; row 7 is `street-bollard`. The number 119
|
||||||
|
appeared here twice and was never anything: the catalogue is 100 core plus a
|
||||||
|
further 150.
|
||||||
`pepper-mill` reads as a wooden bottle and needs rewriting. `coffee-mug`'s
|
`pepper-mill` reads as a wooden bottle and needs rewriting. `coffee-mug`'s
|
||||||
handle is a flat strap whose wide face turns toward the camera; the section
|
handle is a flat strap whose wide face turns toward the camera; the section
|
||||||
wants to be squarer and deeper in the plane of the loop.
|
wants to be squarer and deeper in the plane of the loop.
|
||||||
|
|
|
||||||
|
|
@ -589,3 +589,45 @@ a.action .state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap
|
||||||
color: var(--amber);
|
color: var(--amber);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- recording ---------- */
|
||||||
|
|
||||||
|
/* The take is locked to 1920x1080, so the preview is letterboxed to match it.
|
||||||
|
Without this the canvas keeps whatever shape its box has and the buffer is
|
||||||
|
stretched into it: the framing you compose is not the framing you get. */
|
||||||
|
body.recording .viewport {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.recording canvas {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nothing in the frame that is not in the file: the overlays are drawn over
|
||||||
|
the canvas by the page, not by the renderer, so they never reach the
|
||||||
|
recording and on screen they only mislead. */
|
||||||
|
body.recording .overlay,
|
||||||
|
body.recording .showcase-caption { opacity: 0; }
|
||||||
|
|
||||||
|
body.recording .viewport::after {
|
||||||
|
content: 'REC';
|
||||||
|
position: absolute;
|
||||||
|
top: 14px;
|
||||||
|
right: 16px;
|
||||||
|
padding: 3px 9px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: #c8341f;
|
||||||
|
color: #fff;
|
||||||
|
font-family: 'IBM Plex Mono', ui-monospace, monospace;
|
||||||
|
font-size: 10px;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
animation: rec-pulse 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rec-pulse { 50% { opacity: 0.35; } }
|
||||||
|
|
|
||||||
|
|
@ -982,7 +982,6 @@ const captionNote = app.querySelector<HTMLElement>('[data-caption-note]')!
|
||||||
const recordButton = app.querySelector<HTMLButtonElement>('[data-record]')!
|
const recordButton = app.querySelector<HTMLButtonElement>('[data-record]')!
|
||||||
const recordState = recordButton.querySelector<HTMLElement>('.state')!
|
const recordState = recordButton.querySelector<HTMLElement>('.state')!
|
||||||
|
|
||||||
let armed = false
|
|
||||||
let recorder: MediaRecorder | undefined
|
let recorder: MediaRecorder | undefined
|
||||||
let morphStart: MorphFrame | undefined
|
let morphStart: MorphFrame | undefined
|
||||||
let morphEnd: MorphFrame | undefined
|
let morphEnd: MorphFrame | undefined
|
||||||
|
|
@ -1056,7 +1055,14 @@ const showcase = createShowcase({
|
||||||
* wants MP4, so the README documents the one-line ffmpeg remux rather than
|
* wants MP4, so the README documents the one-line ffmpeg remux rather than
|
||||||
* pretending the file is ready to post.
|
* pretending the file is ready to post.
|
||||||
*/
|
*/
|
||||||
function startRecording(seconds: number): void {
|
/** Local time, colons out: several takes in a session must not overwrite. */
|
||||||
|
function stamp(): string {
|
||||||
|
const now = new Date()
|
||||||
|
const pad = (n: number): string => String(n).padStart(2, '0')
|
||||||
|
return `${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function startRecording(label: string): void {
|
||||||
// Lock to 1080p at pixel ratio 1: `captureStream` takes the drawing buffer,
|
// Lock to 1080p at pixel ratio 1: `captureStream` takes the drawing buffer,
|
||||||
// so a ratio of 2 would record 3840x2160 and cost four times the pixels for
|
// so a ratio of 2 would record 3840x2160 and cost four times the pixels for
|
||||||
// a clip nobody will view above 1080.
|
// a clip nobody will view above 1080.
|
||||||
|
|
@ -1065,6 +1071,16 @@ function startRecording(seconds: number): void {
|
||||||
renderer.setSize(1920, 1080, false)
|
renderer.setSize(1920, 1080, false)
|
||||||
camera.aspect = 1920 / 1080
|
camera.aspect = 1920 / 1080
|
||||||
camera.updateProjectionMatrix()
|
camera.updateProjectionMatrix()
|
||||||
|
/**
|
||||||
|
* Letterboxed, so what is on screen is what is in the file.
|
||||||
|
*
|
||||||
|
* `setSize(..., false)` deliberately leaves the CSS box alone: it changes the
|
||||||
|
* drawing buffer and nothing else. That is right for the recording and wrong
|
||||||
|
* for the person making it, because a 1920x1080 buffer stretched into a box
|
||||||
|
* of some other shape is a preview that lies about its own framing. Whoever
|
||||||
|
* is driving the sliders is composing a shot they cannot see.
|
||||||
|
*/
|
||||||
|
document.body.classList.add('recording')
|
||||||
|
|
||||||
const stream = canvas.captureStream(60)
|
const stream = canvas.captureStream(60)
|
||||||
const types = ['video/webm;codecs=vp9', 'video/webm;codecs=vp8', 'video/webm']
|
const types = ['video/webm;codecs=vp9', 'video/webm;codecs=vp8', 'video/webm']
|
||||||
|
|
@ -1080,10 +1096,13 @@ function startRecording(seconds: number): void {
|
||||||
const url = URL.createObjectURL(new Blob(chunks, { type: mimeType }))
|
const url = URL.createObjectURL(new Blob(chunks, { type: mimeType }))
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
link.download = `medieval-kit-${seconds}s.webm`
|
link.download = `medieval-kit-${label}.webm`
|
||||||
link.click()
|
link.click()
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 5000)
|
setTimeout(() => URL.revokeObjectURL(url), 5000)
|
||||||
recorder = undefined
|
recorder = undefined
|
||||||
|
recordButton.setAttribute('aria-pressed', 'false')
|
||||||
|
recordState.textContent = 'off'
|
||||||
|
document.body.classList.remove('recording')
|
||||||
if (recordingSize) {
|
if (recordingSize) {
|
||||||
renderer.setPixelRatio(recordingSize.ratio)
|
renderer.setPixelRatio(recordingSize.ratio)
|
||||||
recordingSize = undefined
|
recordingSize = undefined
|
||||||
|
|
@ -1121,17 +1140,29 @@ document.addEventListener('visibilitychange', () => {
|
||||||
function runShowcase(seconds: number): void {
|
function runShowcase(seconds: number): void {
|
||||||
if (showcase.isRunning()) return
|
if (showcase.isRunning()) return
|
||||||
showcase.start(seconds)
|
showcase.start(seconds)
|
||||||
if (armed) startRecording(seconds)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const button of app.querySelectorAll<HTMLButtonElement>('[data-showcase]')) {
|
for (const button of app.querySelectorAll<HTMLButtonElement>('[data-showcase]')) {
|
||||||
button.addEventListener('click', () => runShowcase(Number(button.dataset.showcase)))
|
button.addEventListener('click', () => runShowcase(Number(button.dataset.showcase)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records what you are doing, not only what the tour does.
|
||||||
|
*
|
||||||
|
* This used to arm the NEXT showcase and nothing else, so the one thing it
|
||||||
|
* could not capture was somebody driving the model themselves: pulling the
|
||||||
|
* sliders, turning it over, finding the angle. That is most of what the
|
||||||
|
* inspector is for. Now it starts and stops on the spot, and a tour started
|
||||||
|
* while it is running is captured like anything else.
|
||||||
|
*/
|
||||||
recordButton.addEventListener('click', () => {
|
recordButton.addEventListener('click', () => {
|
||||||
armed = !armed
|
if (recorder) {
|
||||||
recordButton.setAttribute('aria-pressed', String(armed))
|
recorder.stop()
|
||||||
recordState.textContent = armed ? 'armed' : 'off'
|
return
|
||||||
|
}
|
||||||
|
startRecording(stamp())
|
||||||
|
recordButton.setAttribute('aria-pressed', 'true')
|
||||||
|
recordState.textContent = 'stop'
|
||||||
})
|
})
|
||||||
|
|
||||||
function endShowcase(): void {
|
function endShowcase(): void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue