@phil65/demoreel 0.3.1 → 0.5.0

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.
Files changed (43) hide show
  1. package/README.md +47 -12
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/args.js +26 -0
  4. package/dist/cli.js +53 -3
  5. package/dist/compose.d.ts +4 -0
  6. package/dist/compose.js +4 -0
  7. package/dist/gif.d.ts +16 -0
  8. package/dist/gif.js +19 -0
  9. package/dist/index.d.ts +5 -3
  10. package/dist/index.js +4 -2
  11. package/dist/mcp.d.ts +5 -0
  12. package/dist/mcp.js +441 -0
  13. package/dist/openscreen/project.js +3 -3
  14. package/dist/project.d.ts +51 -1
  15. package/dist/project.js +89 -1
  16. package/dist/record.d.ts +6 -1
  17. package/dist/record.js +2 -1
  18. package/dist/renderer/assets/CanvasPool-PBu3bHFZ.js +1 -0
  19. package/dist/renderer/assets/CanvasRenderer-HmF-4gyW.js +1 -0
  20. package/dist/renderer/assets/RenderTargetSystem-Dk1U4wDJ.js +184 -0
  21. package/dist/renderer/assets/WebGLRenderer-C0v9HBel.js +149 -0
  22. package/dist/renderer/assets/WebGPURenderer-Ce0-U9Q1.js +95 -0
  23. package/dist/renderer/assets/{browserAll-aHn2isHo.js → browserAll-DhvWQ7nM.js} +2 -2
  24. package/dist/renderer/assets/canvasUtils-KRroregW.js +1 -0
  25. package/dist/renderer/assets/{getTexelRangeRects-yD6MQ0xy.js → getTexelRangeRects-D3pwCyRt.js} +3 -3
  26. package/dist/renderer/assets/index-CE-lli1m.js +556 -0
  27. package/dist/renderer/assets/init-DfmWKarH.js +83 -0
  28. package/dist/renderer/assets/webworkerAll-B41hok0-.js +1 -0
  29. package/dist/renderer/index.html +1 -6
  30. package/dist/scene.d.ts +24 -4
  31. package/dist/scene.js +74 -5
  32. package/dist/sheet.d.ts +6 -0
  33. package/dist/sheet.js +10 -0
  34. package/dist/types.d.ts +4 -0
  35. package/package.json +7 -1
  36. package/skills/demoreel/SKILL.md +161 -0
  37. package/dist/renderer/assets/CanvasPool-CHSHS1-v.js +0 -23
  38. package/dist/renderer/assets/RenderTargetSystem-EAUH9iQk.js +0 -404
  39. package/dist/renderer/assets/canvasUtils-n5g2f3_X.js +0 -1
  40. package/dist/renderer/assets/getTextureBatchBindGroup-Bwvgbco6.js +0 -1
  41. package/dist/renderer/assets/index-BwP6rH7I.js +0 -556
  42. package/dist/renderer/assets/init-C2Za5NQh.js +0 -83
  43. package/dist/renderer/assets/webworkerAll-JSSmbaR2.js +0 -1
@@ -0,0 +1,83 @@
1
+ import{B as e,Ct as t,Dt as n,Et as r,H as i,L as a,M as o,R as s,Z as c,b as l,ct as u,dt as d,ut as f,z as p}from"./index-CE-lli1m.js";import{t as m}from"./canvasUtils-KRroregW.js";import{t as h}from"./CanvasPool-PBu3bHFZ.js";var g=new t;function _(e,t){t.clear();let n=t.matrix;for(let n=0;n<e.length;n++){let r=e[n];if(r.globalDisplayStatus<7)continue;let i=r.renderGroup??r.parentRenderGroup;t.matrix=i?.isCachedAsTexture?g.copyFrom(i.textureOffsetInverseTransform).append(r.worldTransform):i?._parentCacheAsTextureRenderGroup?g.copyFrom(i._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(r.groupTransform):r.worldTransform,t.addBounds(r.bounds)}return t.matrix=n,t}var v=new f;function y(e,t,n,r,i=!1,a){let o=v;o.minX=0,o.minY=0,o.maxX=e.width/r|0,o.maxY=e.height/r|0;let s=c.getOptimalTexture({width:o.width,height:o.height,resolution:r,autoGenerateMipmaps:i,scaleMode:a});return s.source.uploadMethodId=`image`,s.source.resource=e,s.source.alphaMode=`premultiply-alpha-on-upload`,s.frame.width=t/r,s.frame.height=n/r,s.source.emit(`update`,s.source),s.updateUvs(),s}function b(e){return typeof e.getCanvasFilterString==`function`}var x=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new f,this.cssFilterString=``}},S=class{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){let t=this._pushFilterFrame(),n=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=n,t.container=e.container,t.cssFilterString=``,n.every(e=>!e.enabled)){t.skip=!0;return}let r=[];for(let e of n){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&r.push(t)}if(r.length===0){t.skip=!0;return}t.cssFilterString=r.join(` `),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;let i=this.renderer.canvasContext.activeContext,a=i.filter||`none`;if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){let e=this.renderer.canvasContext.activeResolution||1;i.save(),i.setTransform(1,0,0,1,0,0),i.beginPath(),i.rect(t.bounds.x*e,t.bounds.y*e,t.bounds.width*e,t.bounds.height*e),i.clip()}else t.useClip=!1;t.cssFilterString&&(i.filter=a===`none`?t.cssFilterString:`${a} ${t.cssFilterString}`)}pop(){let e=this._popFilterFrame();if(e.skip)return;let t=this._savedStates.pop();if(!t)return;let n=this.renderer.canvasContext.activeContext;e.useClip?n.restore():n.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(e=>!e.enabled))return e;let n=[];for(let e of t){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&n.push(t)}if(n.length===0)return e;let r=m.getCanvasSource(e);if(!r)return e;let i=e.frame,a=e.source._resolution??e.source.resolution??1,o=i.width,s=i.height,{canvas:c,context:l}=h.getOptimalCanvasAndContext(o,s,a);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,c.width,c.height),n.length&&(l.filter=n.join(` `));let u=i.x*a,d=i.y*a,f=o*a,p=s*a;return l.drawImage(r,u,d,f,p,0,0,f,p),l.filter=`none`,l.globalAlpha=1,y(c,o,s,a)}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup)?.cacheToLocalTransform;n&&t.applyMatrix(n)}}_warnUnsupportedFilter(e){let t=e?.constructor?.name||`Filter`;this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new x,this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}};S.extension={type:[r.CanvasSystem],name:`filter`};var C=`in vec2 aPosition;
2
+ out vec2 vTextureCoord;
3
+
4
+ uniform vec4 uInputSize;
5
+ uniform vec4 uOutputFrame;
6
+ uniform vec4 uOutputTexture;
7
+
8
+ vec4 filterVertexPosition( void )
9
+ {
10
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
11
+
12
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
13
+ position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
14
+
15
+ return vec4(position, 0.0, 1.0);
16
+ }
17
+
18
+ vec2 filterTextureCoord( void )
19
+ {
20
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
21
+ }
22
+
23
+ void main(void)
24
+ {
25
+ gl_Position = filterVertexPosition();
26
+ vTextureCoord = filterTextureCoord();
27
+ }
28
+ `,w=`in vec2 vTextureCoord;
29
+ out vec4 finalColor;
30
+ uniform sampler2D uTexture;
31
+ void main() {
32
+ finalColor = texture(uTexture, vTextureCoord);
33
+ }
34
+ `,T=`struct GlobalFilterUniforms {
35
+ uInputSize: vec4<f32>,
36
+ uInputPixel: vec4<f32>,
37
+ uInputClamp: vec4<f32>,
38
+ uOutputFrame: vec4<f32>,
39
+ uGlobalFrame: vec4<f32>,
40
+ uOutputTexture: vec4<f32>,
41
+ };
42
+
43
+ @group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
44
+ @group(0) @binding(1) var uTexture: texture_2d<f32>;
45
+ @group(0) @binding(2) var uSampler: sampler;
46
+
47
+ struct VSOutput {
48
+ @builtin(position) position: vec4<f32>,
49
+ @location(0) uv: vec2<f32>
50
+ };
51
+
52
+ fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
53
+ {
54
+ var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
55
+
56
+ position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
57
+ position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
58
+
59
+ return vec4(position, 0.0, 1.0);
60
+ }
61
+
62
+ fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
63
+ {
64
+ return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
65
+ }
66
+
67
+ @vertex
68
+ fn mainVertex(
69
+ @location(0) aPosition: vec2<f32>,
70
+ ) -> VSOutput {
71
+ return VSOutput(
72
+ filterVertexPosition(aPosition),
73
+ filterTextureCoord(aPosition)
74
+ );
75
+ }
76
+
77
+ @fragment
78
+ fn mainFragment(
79
+ @location(0) uv: vec2<f32>,
80
+ ) -> @location(0) vec4<f32> {
81
+ return textureSample(uTexture, uSampler, uv);
82
+ }
83
+ `,E=class extends o{constructor(){let t=e.from({vertex:{source:T,entryPoint:`mainVertex`},fragment:{source:T,entryPoint:`mainFragment`},name:`passthrough-filter`}),n=i.from({vertex:C,fragment:w,name:`passthrough-filter`});super({gpuProgram:t,glProgram:n})}},D=class{constructor(e){this._renderer=e}push(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:`filter`,canBundle:!1,action:`pushFilter`,container:t,filterEffect:e})}pop(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:`filter`,action:`popFilter`,canBundle:!1})}execute(e){e.action===`pushFilter`?this._renderer.filter.push(e):e.action===`popFilter`&&this._renderer.filter.pop()}destroy(){this._renderer=null}};D.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:`filter`};var O=new l({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:`float32x2`,stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),k=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new f,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}},A=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new p({uInputSize:{value:new Float32Array(4),type:`vec4<f32>`},uInputPixel:{value:new Float32Array(4),type:`vec4<f32>`},uInputClamp:{value:new Float32Array(4),type:`vec4<f32>`},uOutputFrame:{value:new Float32Array(4),type:`vec4<f32>`},uGlobalFrame:{value:new Float32Array(4),type:`vec4<f32>`},uOutputTexture:{value:new Float32Array(4),type:`vec4<f32>`}}),this._globalFilterBindGroup=new s({}),this.renderer=e}init(){c.on(`evict`,this._unbindPassTextures,this)}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,n=e.filterEffect.filters,r=this._pushFilterData();r.skip=!1,r.filters=n,r.container=e.container,r.outputRenderSurface=t.renderTarget.renderSurface;let i=t.renderTarget.renderTarget.colorTexture.source,a=i.resolution,o=i.antialias;if(n.every(e=>!e.enabled)){r.skip=!0;return}let s=r.bounds;if(this._calculateFilterArea(e,s),this._calculateFilterBounds(r,t.renderTarget.rootViewPort,o,a,1),r.skip)return;let c=this._getPreviousFilterData();this._setupFilterTextures(r,s,t,c)}generateFilteredTexture({texture:e,filters:t}){if(t.every(e=>!e.enabled))return e;let n=this._pushFilterData();this._activeFilterData=n,n.skip=!1,n.filters=t;let r=e.source,i=r.resolution,a=r.antialias,o=n.bounds;if(o.clear(),o.addRect(e.frame),this._calculateFilterBounds(n,o.rectangle,a,i,0),n.skip)return this._popFilterData(),e;n.outputRenderSurface=c.getOptimalTexture({width:o.width,height:o.height,resolution:n.resolution,antialias:n.antialias}),n.backTexture=d.EMPTY,n.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(n,!0);let s=n.outputRenderSurface;return s.source.alphaMode=`premultiplied-alpha`,this._popFilterData(),s}pop(){let e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&c.returnTexture(t.backTexture),c.returnTexture(t.inputTexture))}getBackTexture(e,t,n){let{_resolution:r,format:i}=e.colorTexture.source,a=c.getOptimalTexture({width:t.width,height:t.height,resolution:r,format:i});return this._copyBackTexture(e,a,t,n)}_copyBackTexture(e,t,n,r){let i=t.source._resolution,a=n.minX,o=n.minY;r&&(a-=r.minX,o-=r.minY),a=Math.floor(a*i+1e-6),o=Math.floor(o*i+1e-6);let s=Math.min(Math.ceil(n.width*i),t.source.pixelWidth),c=Math.min(Math.ceil(n.height*i),t.source.pixelHeight);return this.renderer.renderTarget.copyToTexture(e,t,{x:a,y:o},{width:s,height:c},{x:0,y:0}),t}applyFilter(e,t,n,r){let i=this.renderer,a=this._activeFilterData,o=a.outputRenderSurface===n,s=this._findClosestFilterData(),c=s?s.inputTexture.source._resolution:i.renderTarget.rootRenderTarget.colorTexture.source._resolution,l=0,u=0;o&&s&&(l=s.bounds.minX,u=s.bounds.minY),this._updateFilterUniforms(t,n,a,l,u,c,o,r);let d=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(d,t,i)}calculateSpriteMatrix(e,n){let r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),a=n.worldTransform.copyTo(t.shared),o=n.renderGroup||n.parentRenderGroup;return o&&o.cacheToLocalTransform&&a.prepend(o.cacheToLocalTransform),a.invert(),i.prepend(a),i.scale(1/n.texture.orig.width,1/n.texture.orig.height),i.translate(n.anchor.x,n.anchor.y),i}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null,c.off(`evict`,this._unbindPassTextures,this),this._globalFilterBindGroup.destroy()}_unbindPassTextures(){let e=this._globalFilterBindGroup;e.setResource(d.EMPTY.source,1),e.setResource(d.EMPTY.source.style,2),e.setResource(d.EMPTY.source,3)}_getPassthroughFilter(){return this._passthroughFilter??=new E,this._passthroughFilter}_setupBindGroupsAndRender(e,t,n){if(n.renderPipes.uniformBatch){let e=n.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(e,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:O,shader:e,state:e._state,topology:`triangle-list`}),n.type===a.WEBGL&&n.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,n,r){if(e.backTexture=d.EMPTY,e.inputTexture=c.getOptimalTexture({width:t.width,height:t.height,resolution:e.resolution,antialias:e.antialias}),e.blendRequired){n.renderTarget.finishRenderPass();let i=n.renderTarget.getRenderTarget(e.outputRenderSurface),a=i.colorTexture.source,o=c.getAlignedTexture(e.inputTexture,a._resolution,a.format);e.backTexture=this._copyBackTexture(i,o,t,r?.bounds)}n.renderTarget.bind({target:e.inputTexture,clear:!0}),n.globalUniforms.push({offset:t})}_updateFilterUniforms(e,t,n,r,i,a,o,s){let c=this._filterGlobalUniforms.uniforms,l=c.uOutputFrame,u=c.uInputSize,f=c.uInputPixel,p=c.uInputClamp,m=c.uGlobalFrame,h=c.uOutputTexture;o?(l[0]=n.bounds.minX-r,l[1]=n.bounds.minY-i):(l[0]=0,l[1]=0),l[2]=e.frame.width,l[3]=e.frame.height,u[0]=e.source.width,u[1]=e.source.height,u[2]=1/u[0],u[3]=1/u[1],f[0]=e.source.pixelWidth,f[1]=e.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],p[0]=.5*f[2],p[1]=.5*f[3],p[2]=e.frame.width*u[2]-.5*f[2],p[3]=e.frame.height*u[3]-.5*f[3];let g=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=r*a,m[1]=i*a,m[2]=g.source.width*a,m[3]=g.source.height*a,t instanceof d&&(t.source.resource=null);let _=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind({target:t,clear:!!s}),t instanceof d?(h[0]=t.frame.width,h[1]=t.frame.height):(h[0]=_.width,h[1]=_.height),h[2]=_.isRoot?-1:1,this._filterGlobalUniforms.update()}_findClosestFilterData(){for(let e=this._filterStackIndex-1;e>=0;e--){let t=this._filterStack[e];if(!t.skip)return t}return null}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;n&&t.applyMatrix(n)}}_applyFiltersToTexture(e,t){let n=e.inputTexture,r=e.bounds,i=e.filters,a=e.firstEnabledIndex,o=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(n.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),a===o)i[a].apply(this,n,e.outputRenderSurface,t);else{let n=e.inputTexture,s=c.getOptimalTexture({width:r.width,height:r.height,resolution:n.source._resolution}),l=s;for(let e=a;e<o;e++){let t=i[e];if(!t.enabled)continue;t.apply(this,n,l,!0);let r=n;n=l,l=r}i[o].apply(this,n,e.outputRenderSurface,t),c.returnTexture(s)}}_calculateFilterBounds(e,t,n,r,i){let a=this.renderer,o=e.bounds,s=e.filters,c=1/0,l=0,d=!0,f=!1,p=!1,m=!0,h=-1,g=-1;for(let e=0;e<s.length;e++){let t=s[e];if(t.enabled){if(h===-1&&(h=e),g=e,c=Math.min(c,t.resolution===`inherit`?r:t.resolution),l+=t.padding,t.antialias===`off`?d=!1:t.antialias===`inherit`&&(d&&=n),t.clipToViewport||(m=!1),!(t.compatibleRenderers&a.type)){p=!1;break}if(t.blendRequired&&!(a.backBuffer?.useBackBuffer??!0)){u("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),p=!1;break}p=!0,f||=t.blendRequired}}p?(m&&o.fitBounds(0,t.width/r,0,t.height/r),o.scale(c).ceil().scale(1/c).pad((l|0)*i),o.isPositive?(e.antialias=d,e.resolution=c,e.blendRequired=f,e.firstEnabledIndex=h,e.lastEnabledIndex=g):e.skip=!0):e.skip=!0}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){for(let e=this._filterStackIndex-2;e>=0;e--){let t=this._filterStack[e];if(!t.skip)return t}return null}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new k,this._filterStackIndex++,e}};A.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:`filter`},n.add(A,S),n.add(D);
@@ -0,0 +1 @@
1
+ import"./index-CE-lli1m.js";import"./init-DfmWKarH.js";
@@ -1,11 +1,6 @@
1
1
  <!doctype html>
2
2
  <html>
3
- <head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-BwP6rH7I.js"></script>
4
- <link rel="modulepreload" crossorigin href="./assets/CanvasPool-CHSHS1-v.js">
5
- <link rel="modulepreload" crossorigin href="./assets/canvasUtils-n5g2f3_X.js">
6
- <link rel="modulepreload" crossorigin href="./assets/RenderTargetSystem-EAUH9iQk.js">
7
- <link rel="modulepreload" crossorigin href="./assets/getTextureBatchBindGroup-Bwvgbco6.js">
8
- <link rel="modulepreload" crossorigin href="./assets/getTexelRangeRects-yD6MQ0xy.js">
3
+ <head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-CE-lli1m.js"></script>
9
4
  </head>
10
5
  <body style="margin:0;background:#111;color:#ddd;font:14px sans-serif">
11
6
  <div id="status">demoreel headless renderer</div>
package/dist/scene.d.ts CHANGED
@@ -80,6 +80,14 @@ export interface ZoomOptions {
80
80
  wait?: boolean;
81
81
  label?: string;
82
82
  }
83
+ export interface ClickRippleOptions {
84
+ /** Ring stroke colour (default "rgba(96, 165, 250, 0.9)"). */
85
+ color?: string;
86
+ /** Base ring diameter in px before expansion (default 36). */
87
+ size?: number;
88
+ /** Ripple animation duration in ms (default 380). */
89
+ durationMs?: number;
90
+ }
83
91
  export interface HighlightOptions {
84
92
  /** How long the highlight stays (ms, default 1800). */
85
93
  duration?: number;
@@ -87,12 +95,23 @@ export interface HighlightOptions {
87
95
  color?: string;
88
96
  /** Space between element and outline (px, default 6). */
89
97
  padding?: number;
98
+ /** Spotlight backdrop dim outside the element (`true` => 0.55 opacity, or a 0-1 alpha). */
99
+ dim?: boolean | number;
100
+ /** Optional short callout badge floating next to the highlighted element. */
101
+ badge?: string;
90
102
  /** Also zoom onto the element while highlighted (default false). */
91
103
  zoom?: boolean | ZoomHint;
92
104
  /** Block until the highlight is gone (default false). */
93
105
  wait?: boolean;
94
106
  label?: string;
95
107
  }
108
+ export interface PressOptions {
109
+ label?: string;
110
+ /** Show a keycap HUD overlay for this key press (overrides `look.showKeys`). */
111
+ show?: boolean;
112
+ /** How long the keycap HUD stays visible (ms). */
113
+ duration?: number;
114
+ }
96
115
  /** Applies a `data-demoreel-zoom` value to an action's zoom setting. */
97
116
  export declare function applyZoomAnchor(zoom: boolean | ZoomHint, anchor: {
98
117
  value: string;
@@ -108,6 +127,7 @@ export declare class Scene {
108
127
  private recorder;
109
128
  private startRecording;
110
129
  private fast;
130
+ private clickRipple;
111
131
  pacing: PacingOptions;
112
132
  /** The underlying Playwright page, for anything the Scene API does not cover. */
113
133
  readonly page: Page;
@@ -115,6 +135,7 @@ export declare class Scene {
115
135
  constructor(page: Page, viewport: Viewport, startRecording: () => Promise<SceneClock>, opts?: {
116
136
  seed?: number;
117
137
  pacing?: Partial<PacingOptions>;
138
+ clickRipple?: boolean | ClickRippleOptions;
118
139
  fast?: boolean;
119
140
  });
120
141
  private ensureRecording;
@@ -131,6 +152,7 @@ export declare class Scene {
131
152
  private kindAt;
132
153
  /** Moves the real mouse along an eased curve at ~60 Hz, recording every position. */
133
154
  private travel;
155
+ private showClickRipple;
134
156
  private clickHere;
135
157
  private record;
136
158
  goto(url: string, opts?: {
@@ -160,9 +182,7 @@ export declare class Scene {
160
182
  clear?: boolean;
161
183
  }): Promise<void>;
162
184
  /** Presses a key or chord (Playwright syntax, e.g. "Enter", "Control+K"). */
163
- press(key: string, opts?: {
164
- label?: string;
165
- }): Promise<void>;
185
+ press(key: string, opts?: PressOptions): Promise<void>;
166
186
  hover(target: Target, opts?: ActionOptions & {
167
187
  dwell?: number;
168
188
  }): Promise<void>;
@@ -189,7 +209,7 @@ export declare class Scene {
189
209
  * Non-blocking by default: script the actions to show while zoomed right after it.
190
210
  */
191
211
  zoom(target: Target, opts?: ZoomOptions): Promise<void>;
192
- /** Draws an outline around an element in the page (recorded, so it zooms with the page). */
212
+ /** Draws an outline (and optional spotlight dim / badge) around an element in the page. */
193
213
  highlight(target: Target, opts?: HighlightOptions): Promise<void>;
194
214
  pause(ms: number): Promise<void>;
195
215
  /**
package/dist/scene.js CHANGED
@@ -117,6 +117,7 @@ export class Scene {
117
117
  recorder = null;
118
118
  startRecording;
119
119
  fast;
120
+ clickRipple;
120
121
  pacing;
121
122
  /** The underlying Playwright page, for anything the Scene API does not cover. */
122
123
  page;
@@ -129,6 +130,13 @@ export class Scene {
129
130
  this.rand = mulberry32(opts.seed ?? 42);
130
131
  this.pacing = { ...DEFAULT_PACING, ...opts.pacing };
131
132
  this.cursor = { x: viewport.width * 0.62, y: viewport.height * 0.72 };
133
+ this.clickRipple = opts.clickRipple
134
+ ? {
135
+ color: (typeof opts.clickRipple === "object" ? opts.clickRipple.color : undefined) ?? "rgba(96, 165, 250, 0.9)",
136
+ size: (typeof opts.clickRipple === "object" ? opts.clickRipple.size : undefined) ?? 36,
137
+ durationMs: (typeof opts.clickRipple === "object" ? opts.clickRipple.durationMs : undefined) ?? 380,
138
+ }
139
+ : null;
132
140
  }
133
141
  // ---- clock / telemetry -------------------------------------------------------------------
134
142
  async ensureRecording() {
@@ -244,7 +252,38 @@ export class Scene {
244
252
  await this.page.mouse.move(to.x, to.y);
245
253
  this.sample("move");
246
254
  }
255
+ async showClickRipple(at) {
256
+ if (!this.clickRipple || this.fast)
257
+ return;
258
+ const cfg = this.clickRipple;
259
+ await this.page
260
+ .evaluate((o) => {
261
+ const d = document.createElement("div");
262
+ d.setAttribute("data-demoreel-ripple", "");
263
+ d.style.cssText = [
264
+ "position:fixed",
265
+ `left:${o.x}px`,
266
+ `top:${o.y}px`,
267
+ `width:${o.size}px`,
268
+ `height:${o.size}px`,
269
+ "border-radius:9999px",
270
+ `border:3px solid ${o.color}`,
271
+ `box-shadow:0 0 12px color-mix(in srgb, ${o.color} 50%, transparent)`,
272
+ "pointer-events:none",
273
+ "z-index:2147483647",
274
+ "transform:translate(-50%,-50%) scale(0.35)",
275
+ ].join(";");
276
+ document.documentElement.appendChild(d);
277
+ const anim = d.animate([
278
+ { transform: "translate(-50%,-50%) scale(0.35)", opacity: 0.95 },
279
+ { transform: "translate(-50%,-50%) scale(1.75)", opacity: 0 },
280
+ ], { duration: o.durationMs, easing: "cubic-bezier(0.22, 1, 0.36, 1)", fill: "forwards" });
281
+ anim.onfinish = () => d.remove();
282
+ }, { x: at.x, y: at.y, ...cfg })
283
+ .catch(() => { });
284
+ }
247
285
  async clickHere() {
286
+ await this.showClickRipple(this.cursor);
248
287
  await this.page.mouse.down();
249
288
  this.sample("click");
250
289
  await sleep(this.ms(70 + this.rand() * 40));
@@ -310,6 +349,7 @@ export class Scene {
310
349
  await this.travel(this.aimPoint(box), box, kind);
311
350
  const arriveMs = this.now();
312
351
  await sleep(this.ms(this.pacing.aimDwell));
352
+ await this.showClickRipple(this.cursor);
313
353
  this.sample("click");
314
354
  await loc.selectOption(value);
315
355
  await sleep(this.ms(70));
@@ -441,8 +481,16 @@ export class Scene {
441
481
  await this.ensureRecording();
442
482
  const startMs = this.now();
443
483
  await this.page.keyboard.press(key);
444
- this.record({ kind: "press", startMs, arriveMs: startMs, label: opts.label ?? key });
445
- await sleep(this.ms(300));
484
+ this.record({
485
+ kind: "press",
486
+ startMs,
487
+ arriveMs: startMs,
488
+ label: opts.label ?? key,
489
+ text: key,
490
+ ...(opts.show !== undefined ? { showKey: opts.show } : {}),
491
+ ...(opts.duration !== undefined ? { keyDurationMs: opts.duration } : {}),
492
+ });
493
+ await sleep(this.ms(260));
446
494
  }
447
495
  async hover(target, opts = {}) {
448
496
  await this.ensureRecording();
@@ -566,16 +614,19 @@ export class Scene {
566
614
  if (opts.wait && !this.fast)
567
615
  await sleep(duration);
568
616
  }
569
- /** Draws an outline around an element in the page (recorded, so it zooms with the page). */
617
+ /** Draws an outline (and optional spotlight dim / badge) around an element in the page. */
570
618
  async highlight(target, opts = {}) {
571
619
  await this.ensureRecording();
572
620
  const { loc, box, anchor } = await this.prepare(target);
573
621
  const startMs = this.now();
574
622
  const duration = this.ms(opts.duration ?? 1800);
623
+ const dimAlpha = opts.dim === true ? 0.55 : typeof opts.dim === "number" ? Math.min(0.95, Math.max(0, opts.dim)) : 0;
575
624
  await loc.evaluate((el, o) => {
576
625
  const r = el.getBoundingClientRect();
577
626
  const d = document.createElement("div");
578
627
  d.setAttribute("data-demoreel-highlight", "");
628
+ const glow = `0 0 0 4px color-mix(in srgb, ${o.color} 30%, transparent), 0 0 24px 4px color-mix(in srgb, ${o.color} 45%, transparent)`;
629
+ const shadow = o.dimAlpha > 0 ? `${glow}, 0 0 0 9999px rgba(6, 9, 20, ${o.dimAlpha})` : glow;
579
630
  d.style.cssText = [
580
631
  "position:fixed",
581
632
  `left:${r.left - o.padding}px`,
@@ -584,12 +635,30 @@ export class Scene {
584
635
  `height:${r.height + 2 * o.padding}px`,
585
636
  `border:3px solid ${o.color}`,
586
637
  "border-radius:10px",
587
- `box-shadow:0 0 0 4px color-mix(in srgb, ${o.color} 30%, transparent), 0 0 24px 4px color-mix(in srgb, ${o.color} 45%, transparent)`,
638
+ `box-shadow:${shadow}`,
588
639
  "pointer-events:none",
589
640
  "z-index:2147483647",
590
641
  "opacity:0",
591
642
  "transition:opacity 220ms ease-out",
592
643
  ].join(";");
644
+ if (o.badge) {
645
+ const b = document.createElement("div");
646
+ b.textContent = o.badge;
647
+ const above = r.top - o.padding > 44;
648
+ b.style.cssText = [
649
+ "position:absolute",
650
+ "left:0",
651
+ above ? "bottom:calc(100% + 10px)" : "top:calc(100% + 10px)",
652
+ `background:${o.color}`,
653
+ "color:#0b1020",
654
+ "font:700 13px/1.2 Inter,system-ui,-apple-system,sans-serif",
655
+ "padding:5px 10px",
656
+ "border-radius:7px",
657
+ "white-space:nowrap",
658
+ "box-shadow:0 4px 16px rgba(0,0,0,0.35)",
659
+ ].join(";");
660
+ d.appendChild(b);
661
+ }
593
662
  document.documentElement.appendChild(d);
594
663
  requestAnimationFrame(() => {
595
664
  d.style.opacity = "1";
@@ -598,7 +667,7 @@ export class Scene {
598
667
  d.style.opacity = "0";
599
668
  setTimeout(() => d.remove(), 260);
600
669
  }, Math.max(0, o.duration - 260));
601
- }, { duration, color: opts.color ?? "#ffcc00", padding: opts.padding ?? 6 });
670
+ }, { duration, color: opts.color ?? "#ffcc00", padding: opts.padding ?? 6, dimAlpha, badge: opts.badge ?? "" });
602
671
  this.record({
603
672
  kind: "highlight",
604
673
  startMs,
package/dist/sheet.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  export declare function probeDuration(video: string): Promise<number>;
2
+ /** Extracts a single full-resolution PNG frame at `seconds` from a video via ffmpeg. */
3
+ export declare function extractFrame(video: string, seconds: number, outPng?: string): Promise<{
4
+ outPng: string;
5
+ seconds: number;
6
+ duration: number;
7
+ }>;
2
8
  /** Plain ffmpeg contact sheet: `n` evenly spaced frames with timestamps. */
3
9
  export declare function contactSheet(video: string, outPng: string, n?: number, cols?: number, width?: number): Promise<{
4
10
  outPng: string;
package/dist/sheet.js CHANGED
@@ -11,6 +11,16 @@ export async function probeDuration(video) {
11
11
  const out = await run(ffprobeBin(), ["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", video]);
12
12
  return Number(out.trim());
13
13
  }
14
+ /** Extracts a single full-resolution PNG frame at `seconds` from a video via ffmpeg. */
15
+ export async function extractFrame(video, seconds, outPng) {
16
+ const src = path.resolve(video);
17
+ const duration = await probeDuration(src);
18
+ const clamped = Math.max(0, Math.min(Number.isFinite(seconds) ? seconds : 0, Math.max(0, duration - 0.05)));
19
+ const dst = path.resolve(outPng ?? src.replace(/\.\w+$/, `.frame-${clamped.toFixed(2)}s.png`));
20
+ fs.mkdirSync(path.dirname(dst), { recursive: true });
21
+ await run(ffmpegBin(), ["-y", "-loglevel", "error", "-ss", clamped.toFixed(3), "-i", src, "-frames:v", "1", dst]);
22
+ return { outPng: dst, seconds: clamped, duration };
23
+ }
14
24
  /** Plain ffmpeg contact sheet: `n` evenly spaced frames with timestamps. */
15
25
  export async function contactSheet(video, outPng, n = 12, cols = 4, width = 480) {
16
26
  const duration = await probeDuration(video);
package/dist/types.d.ts CHANGED
@@ -47,6 +47,10 @@ export interface ActionRecord {
47
47
  };
48
48
  label?: string;
49
49
  text?: string;
50
+ /** For `press` actions: override whether a keycap HUD overlay is shown for this key. */
51
+ showKey?: boolean;
52
+ /** For `press` actions: how long the keycap HUD stays visible (ms). */
53
+ keyDurationMs?: number;
50
54
  }
51
55
  export interface ZoomHint {
52
56
  /** Force a depth (1..6) instead of deriving it from the element size. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phil65/demoreel",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Scripted product demo videos (videos as code): Playwright scenarios with auto cursor + auto zoom, rendered headless by OpenScreen's exporter.",
6
6
  "keywords": [
@@ -41,6 +41,7 @@
41
41
  "dist",
42
42
  "examples/local-demo.ts",
43
43
  "examples/demo-app",
44
+ "skills",
44
45
  "licenses",
45
46
  "THIRD_PARTY_NOTICES.md"
46
47
  ],
@@ -60,6 +61,7 @@
60
61
  "playwright": ">=1.49.0"
61
62
  },
62
63
  "devDependencies": {
64
+ "@modelcontextprotocol/client": "^2.4.0",
63
65
  "@types/node": "^26.6.6",
64
66
  "ajv": "^8.20.0",
65
67
  "gif.js": "^0.2.0",
@@ -72,5 +74,9 @@
72
74
  "vite": "^8.3.8",
73
75
  "vitest": "^5.1.1",
74
76
  "web-demuxer": "^4.0.0"
77
+ },
78
+ "dependencies": {
79
+ "@modelcontextprotocol/server": "^2.4.0",
80
+ "zod": "^4.6.7"
75
81
  }
76
82
  }
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: demoreel
3
+ description: Make or improve a product demo video with demoreel (Playwright scenario -> auto cursor + auto zoom -> MP4 via OpenScreen). Use when asked to record a demo, screencast or walkthrough video of a web app, or to fix pacing, zoom or captions of one.
4
+ ---
5
+
6
+ # demoreel: the demo video loop
7
+
8
+ Inspect the app first, write a scenario, dry-run it with `demoreel inspect`, record and render,
9
+ inspect a contact sheet instead of watching the video, tune, and repeat. Never judge a video
10
+ you have not inspected.
11
+
12
+ ## 1. Inspect the URL (and log in if needed)
13
+
14
+ ```bash
15
+ npx demoreel login http://localhost:3000 # if auth is required -> .demoreel/auth.json
16
+ npx demoreel inspect http://localhost:3000 --screenshot page.png [--state .demoreel/auth.json]
17
+ ```
18
+
19
+ Read the printed ARIA snapshot (YAML accessibility tree) to pick real, stable role/name or
20
+ selector targets before writing the scenario.
21
+
22
+ ## 2. Write the scenario
23
+
24
+ ```ts
25
+ import { defineScenario } from "@phil65/demoreel";
26
+
27
+ export default defineScenario({
28
+ name: "checkout",
29
+ viewport: { width: 1920, height: 1080 },
30
+ cssZoom: 1.5, // only for pages whose layout you control; crisper text
31
+ // trimIdle: true, // cut dead time ({ ignoreFrames: true } for WebGL / rAF / spinner apps)
32
+ async run(scene) {
33
+ await scene.goto("http://localhost:3000/");
34
+ await scene.caption("Pay in two clicks", { duration: 2800 });
35
+ await scene.click({ role: "button", name: "Add to cart" });
36
+ await scene.select({ label: "Plan" }, "pro");
37
+ await scene.drag({ css: "canvas" }, { dx: 180, dy: -60 }, { duration: 1000 });
38
+ await scene.click("#checkout", { navigates: true });
39
+ await scene.type({ label: "Card number" }, "4242 4242 4242 4242");
40
+ await scene.zoom("#total", { depth: 3, duration: 2000, wait: true });
41
+ await scene.highlight(".receipt", { duration: 1800, dim: true, badge: "Paid" });
42
+ },
43
+ });
44
+ ```
45
+
46
+ - Prefer structured accessibility targets (`{ role: "button", name: "Save" }`,
47
+ `{ label: "Email" }`, `{ placeholder }`, `{ text }`, `{ testId }`, `{ css }`, optional
48
+ `exact` / `nth`): `role` and `label` specs are the most stable choice and automatically
49
+ produce readable default labels in `timeline.json`, `marks.json` and the sheet. Give
50
+ important actions an explicit `label` when you want a shorter or clearer name.
51
+ - Use `scene.drag(from, toOrDelta, opts)` for sliders, 3D/WebGL canvas orbiting, and
52
+ drag-and-drop (it records 60 Hz cursor telemetry so OpenScreen's cursor tracks the drag;
53
+ raw `scene.page.mouse` does not). Use `scene.select(target, value, opts)` for `<select>`
54
+ dropdowns instead of clicking them.
55
+ - Optional visual cues (all opt-in so demos stay clean):
56
+ - `look: { showKeys: true }` (or `{ position, durationMs }` / per-step `scene.press("Control+K", { show: true })`)
57
+ renders crisp shortcut keycap pills (`Ctrl + K`, `Esc`) as OpenScreen annotations (also toggleable via `demoreel rezoom --show-keys`).
58
+ - `clickRipple: true` (or `{ color, size, durationMs }`) adds an expanding translucent ring at each click.
59
+ - `scene.highlight(target, { dim: true, badge: "..." })` adds a spotlight backdrop dim and optional callout pill.
60
+ - `cursor: { size, clickBounce, smoothing, motionBlur, show }` tunes OpenScreen's rendered cursor per scenario.
61
+ - `depth` is an **integer tier `1..6`**, not a raw zoom multiplier:
62
+ `1 = 1.25x`, `2 = 1.5x`, `3 = 1.8x`, `4 = 2.2x`, `5 = 3x`, `6 = 5x`.
63
+ - One idea per caption, 2.5-3.5 s each; start the caption before the action it explains.
64
+ Stick to clean ASCII in captions/labels when possible (some `framesheet` overlay fonts
65
+ render emoji or em-dashes as missing glyphs).
66
+ - Navigation clicks need `navigates: true`.
67
+ - Name the file `*.scenario.ts` in an ESM package, `*.scenario.mts` otherwise.
68
+ - For logged-in apps, set `storageState: "./.demoreel/auth.json"` (relative to the scenario
69
+ file) or pass `--state .demoreel/auth.json` on the CLI.
70
+ - **Skip slow boot/WASM spinners at frame 0**: recording starts on the first `scene.*` call.
71
+ To open directly on the ready UI, call `await scene.page.goto(url)` and `waitForFunction`
72
+ for app readiness before calling `scene.pause()` / `scene.caption()`.
73
+ - **WebGL / Canvas / continuous-rAF apps**: `trimIdle: { minMs: 1200, keepMs: 500, ignoreFrames: true }`
74
+ ensures continuous background repaints or spinners do not block idle trimming of slow
75
+ compute/build waits.
76
+ - **Dark UIs**: set `colorScheme: "dark"` and pair with a deep slate/indigo `look.wallpaper`
77
+ gradient (e.g. `linear-gradient(135deg, #0b1022 0%, #1d2d5c 52%, #3a2368 100%)`) rather than
78
+ bright default gradients.
79
+ - **AI / streaming apps**: mock only the LLM fetch/SSE boundary via `scene.page.evaluate(...)`
80
+ or `page.route(...)` while keeping real client-side/WASM tools live — deterministic, fast,
81
+ zero API cost, and authentic tool results.
82
+
83
+ ## 3. Dry-run and inspect the scenario
84
+
85
+ Verify every selector and check the end state in a second (fast mode: no sleeps, no ffmpeg,
86
+ no output files):
87
+
88
+ ```bash
89
+ npx demoreel inspect checkout.scenario.ts --screenshot end.png
90
+ npx demoreel run checkout.scenario.ts --dry-run
91
+ ```
92
+
93
+ If a step fails, `demoreel inspect` reports the failing action index and error, and
94
+ still prints the ARIA snapshot (and writes `--screenshot`) at the moment of failure. Fix
95
+ broken selectors here before spending time recording.
96
+
97
+ ## 4. Run
98
+
99
+ ```bash
100
+ npx demoreel run checkout.scenario.ts --out out/checkout # record + render + sheet
101
+ npx demoreel run checkout.scenario.ts --gif # also export palette-optimised GIF
102
+ npx demoreel run checkout.scenario.ts --no-render # fast: record only
103
+ npx demoreel run checkout.scenario.ts --quality medium # cheaper drafts
104
+ npx demoreel gif out/checkout --width 960 --fps 12 # export README GIF from existing MP4
105
+ ```
106
+
107
+ No GPU (CI, containers): software rendering is slow; draft with `--viewport 1280x720
108
+ --quality source` and render the final 1080p once (30 fps by default; `--fps 60` for smoother motion at twice the render time).
109
+
110
+ ## 5. Inspect the contact sheet
111
+
112
+ ```bash
113
+ npx demoreel sheet out/checkout -n 16 # framesheet inspect <mp4> --marks marks.json
114
+ ```
115
+
116
+ Read the printed findings, then look at `out/checkout/framesheet/sheet.png` (tiles with click
117
+ points, target boxes, zoom spans and captions drawn on, plus a timeline). Also read
118
+ `out/checkout/timeline.json` (actions with times and boxes, `zoomRegions`, `trimRegions`).
119
+ For dense zoomed UI (tool cards, charts, small text), also extract a full-resolution check
120
+ frame (`npx demoreel frame out/checkout 12.5`) — contact-sheet thumbnails can
121
+ hide small error badges (`✕` vs `✓`), truncated text, or failed tool calls.
122
+
123
+ What to look for:
124
+
125
+ - **Caption covering the target** (framesheet `video-mark-overlap`): the caption box overlaps a
126
+ target box while it is active. Fix: shift the caption in time, shorten it, or set
127
+ `look.captionPosition` (`"auto"` already avoids active targets where it can).
128
+ - **Zoom on the wrong element / too tight / too loose**: the target box is not where the
129
+ action happens, or the zoomed tile cuts off context the viewer needs. Fix: zoom onto a
130
+ container with `data-demoreel-zoom` on it, `{ zoom: { context: 2 } }`, `{ zoom: { depth: 2 } }`,
131
+ `{ zoom: false }`, an explicit `scene.zoom(...)`, or scenario `zoom.maxDepth`.
132
+ - **Dead time**: tiles marked duplicate / long static stretches in the timeline, gaps between
133
+ actions after page loads, or slow typing in a small input (under 0.05% pixel change). Fix:
134
+ `trimIdle: true` (or `{ ignoreFrames: true }` for rAF/WebGL apps), shorter `pause()`,
135
+ higher `pacing.speed` / lower `pacing.typeDelay`, or a shorter typed prompt.
136
+ - **Too fast**: actions closer than ~0.8 s, captions shorter than ~2 s, zoom regions that
137
+ last less than ~1.5 s (they flash). Fix: `pause()`, longer `duration`, `pacing.speed` < 1.
138
+ - **Pan/zoom ping-pong**: many short zoom regions alternating far apart. Fix: larger
139
+ `mergeGapMs`, `maxDepth` lower, or one explicit `scene.zoom()` over the whole step.
140
+ - **Wrong state**: a tile shows an error page, a spinner, a failed tool badge, or an empty
141
+ list. Wait for a specific success selector (not a generic `img` or container) before moving on.
142
+ - **Blank or black tiles** at the start/end: page not loaded at the first `goto`, or the
143
+ ending hold is too short/long.
144
+
145
+ ## 6. Tune without re-recording when you can
146
+
147
+ Zoom and idle changes do not need a new recording:
148
+
149
+ ```bash
150
+ npx demoreel rezoom out/checkout --max-depth 2 --hold 1200 --render
151
+ npx demoreel rezoom out/checkout --trim-idle --idle-options '{"minMs":1500,"keepMs":700}' --render
152
+ npx demoreel rezoom out/checkout --no-auto-zoom --render # only explicit scene.zoom()
153
+ ```
154
+
155
+ Changes to actions, captions, pacing, selectors or `look` need `demoreel run` again.
156
+
157
+ ## 7. Repeat
158
+
159
+ Inspect -> dry-run -> run -> sheet -> fix the worst problem -> run again, until the sheet has no findings you can
160
+ fix and every tile shows what its caption says. Report the final MP4 path, its duration and
161
+ the sheet, and mention anything you could not fix.