multiplane 0.3.3 → 0.3.7
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/LICENSE +202 -202
- package/README.en.md +327 -326
- package/README.md +327 -326
- package/THIRD_PARTY_NOTICES.md +30 -30
- package/examples/alpha.html +18 -18
- package/examples/animation.html +17 -17
- package/examples/assets/OFL.txt +93 -93
- package/examples/assets/card.svg +6 -6
- package/examples/three-cards.html +17 -17
- package/examples/typography.html +17 -17
- package/licenses/GPL-3.0.txt +232 -232
- package/licenses/LGPL-3.0.txt +304 -304
- package/licenses/acorn-LICENSE +21 -21
- package/licenses/colour-LICENSE.md +82 -82
- package/licenses/detect-libc-LICENSE +201 -201
- package/licenses/entities-LICENSE +11 -11
- package/licenses/nanoid-LICENSE +20 -20
- package/licenses/parse5-LICENSE +19 -19
- package/licenses/picocolors-LICENSE +15 -15
- package/licenses/playwright-NOTICE +5 -5
- package/licenses/playwright-ThirdPartyNotices.txt +14 -14
- package/licenses/playwright-core-ThirdPartyNotices.txt +13 -13
- package/licenses/postcss-LICENSE +20 -20
- package/licenses/postcss-value-parser-LICENSE +22 -22
- package/licenses/semver-LICENSE +15 -15
- package/licenses/sharp-LICENSE +191 -191
- package/licenses/sharp-win32-x64-NOTICES.md +45 -45
- package/licenses/source-map-js-LICENSE +28 -28
- package/licenses/three-LICENSE +21 -21
- package/package.json +1 -1
- package/skills/multiplane/SKILL.md +215 -213
- package/src/alpha.mjs +69 -69
- package/src/artifacts.mjs +61 -61
- package/src/browser-recovery.mjs +26 -26
- package/src/capture.mjs +16 -6
- package/src/encoder.mjs +16 -16
- package/src/environment.mjs +56 -56
- package/src/events.mjs +3 -0
- package/src/ffmpeg.mjs +32 -32
- package/src/format.mjs +27 -27
- package/src/frame-rate.mjs +28 -28
- package/src/home-migration.mjs +54 -54
- package/src/hosted.mjs +1 -1
- package/src/lint.mjs +248 -248
- package/src/output-alpha.mjs +36 -36
- package/src/output-check.mjs +110 -110
- package/src/platform.mjs +114 -114
- package/src/png-native.mjs +12 -12
- package/src/png.mjs +74 -74
- package/src/post.mjs +55 -21
- package/src/preview.mjs +23 -23
- package/src/process.mjs +9 -9
- package/src/render-pool.mjs +16 -6
- package/src/render-worker.mjs +5 -3
- package/src/render.mjs +5 -5
- package/src/resource-path.mjs +29 -29
- package/src/resources.mjs +27 -27
- package/src/runtime/camera.js +37 -37
- package/src/runtime/shot.css +9 -9
- package/src/server.mjs +7 -1
- package/src/setup.mjs +51 -51
- package/src/skills.mjs +128 -128
- package/src/stills.mjs +5 -4
- package/src/three/index.js +44 -14
- package/src/verify.mjs +3 -1
- package/src/video-pipe.mjs +6 -6
- package/src/workers.mjs +5 -1
- package/tools/bench/shots/canvas-2d.html +1 -1
- package/tools/bench/shots/dom-light.html +1 -1
- package/tools/bench/shots/scene.js +44 -44
- package/tools/bench/shots/webgl.html +1 -1
- package/tools/install-browser.mjs +18 -18
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
const stage = document.querySelector('#stage');
|
|
2
|
-
const kind = stage.dataset.kind;
|
|
3
|
-
const tiles = [];
|
|
4
|
-
if (kind.startsWith('dom') || kind === 'mixed') {
|
|
5
|
-
const count = kind === 'dom-heavy' ? 1200 : 12;
|
|
6
|
-
for (let i = 0; i < count; i++) {
|
|
7
|
-
const tile = document.createElement('div');
|
|
8
|
-
tile.className = 'tile'; tile.textContent = `Item ${i}`;
|
|
9
|
-
tile.style.left = `${(i % 40) * 48}px`; tile.style.top = `${Math.floor(i / 40) * 35}px`;
|
|
10
|
-
if (kind === 'dom-heavy') tile.style.filter = `blur(${i % 3 * 0.15}px)`;
|
|
11
|
-
stage.append(tile); tiles.push(tile);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
let canvas, ctx, gl, program, timeLocation;
|
|
15
|
-
if (['canvas-2d', 'webgl', 'mixed'].includes(kind)) {
|
|
16
|
-
canvas = document.createElement('canvas'); stage.append(canvas);
|
|
17
|
-
canvas.width = 1920 * devicePixelRatio; canvas.height = 1080 * devicePixelRatio;
|
|
18
|
-
if (kind === 'canvas-2d') ctx = canvas.getContext('2d', { alpha: false, colorSpace: 'srgb' });
|
|
19
|
-
else {
|
|
20
|
-
gl = canvas.getContext('webgl', { alpha: kind === 'mixed', premultipliedAlpha: true, antialias: true, preserveDrawingBuffer: true });
|
|
21
|
-
if (!gl) throw Error('WebGL unavailable');
|
|
22
|
-
const shader = (type, source) => { const s = gl.createShader(type); gl.shaderSource(s, source); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw Error(gl.getShaderInfoLog(s)); return s; };
|
|
23
|
-
program = gl.createProgram();
|
|
24
|
-
gl.attachShader(program, shader(gl.VERTEX_SHADER, 'attribute vec2 p;void main(){gl_Position=vec4(p,0.,1.);}'));
|
|
25
|
-
gl.attachShader(program, shader(gl.FRAGMENT_SHADER, `precision highp float;uniform float t;uniform vec2 size;void main(){vec2 p=gl_FragCoord.xy/size;float stripe=step(.5,fract((p.x+p.y)*12.+t));gl_FragColor=vec4(.15+.55*p.x,.2+.5*p.y,.25+.4*stripe,${kind === 'mixed' ? '.5' : '1.'});}`));
|
|
26
|
-
gl.linkProgram(program); if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw Error(gl.getProgramInfoLog(program));
|
|
27
|
-
gl.useProgram(program); const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER,b); gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),gl.STATIC_DRAW);
|
|
28
|
-
const loc=gl.getAttribLocation(program,'p');gl.enableVertexAttribArray(loc);gl.vertexAttribPointer(loc,2,gl.FLOAT,false,0,0);
|
|
29
|
-
gl.uniform2f(gl.getUniformLocation(program,'size'),canvas.width,canvas.height);timeLocation=gl.getUniformLocation(program,'t');gl.viewport(0,0,canvas.width,canvas.height);
|
|
30
|
-
window.BENCH_GL = gl;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
window.SHOT = {
|
|
34
|
-
duration: 2, fps: 30, ready: document.fonts.load('16px Bench'),
|
|
35
|
-
render(t) {
|
|
36
|
-
for (let i=0;i<tiles.length;i++) tiles[i].style.transform=`translate(${Math.sin(t*3+i)*20}px,${Math.cos(t*2+i)*10}px)`;
|
|
37
|
-
if(ctx){
|
|
38
|
-
// Capture can temporarily change DPR; use the fixed backing-store dimensions.
|
|
39
|
-
ctx.setTransform(canvas.width/1920,0,0,canvas.height/1080,0,0);ctx.fillStyle='#18202c';ctx.fillRect(0,0,1920,1080);
|
|
40
|
-
for(let i=0;i<160;i++){ctx.fillStyle=`hsl(${i*17%360} 60% 60%)`;ctx.beginPath();ctx.arc((i%20)*96+48+Math.sin(t*3+i)*20,Math.floor(i/20)*130+65,28+i%9,0,Math.PI*2);ctx.fill();}
|
|
41
|
-
ctx.fillStyle='#ffffff80';ctx.fillRect(300+t*100,250,600,400);
|
|
42
|
-
}
|
|
43
|
-
if(gl){gl.uniform1f(timeLocation,t);gl.drawArrays(gl.TRIANGLES,0,6);gl.finish();}
|
|
44
|
-
}
|
|
1
|
+
const stage = document.querySelector('#stage');
|
|
2
|
+
const kind = stage.dataset.kind;
|
|
3
|
+
const tiles = [];
|
|
4
|
+
if (kind.startsWith('dom') || kind === 'mixed') {
|
|
5
|
+
const count = kind === 'dom-heavy' ? 1200 : 12;
|
|
6
|
+
for (let i = 0; i < count; i++) {
|
|
7
|
+
const tile = document.createElement('div');
|
|
8
|
+
tile.className = 'tile'; tile.textContent = `Item ${i}`;
|
|
9
|
+
tile.style.left = `${(i % 40) * 48}px`; tile.style.top = `${Math.floor(i / 40) * 35}px`;
|
|
10
|
+
if (kind === 'dom-heavy') tile.style.filter = `blur(${i % 3 * 0.15}px)`;
|
|
11
|
+
stage.append(tile); tiles.push(tile);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
let canvas, ctx, gl, program, timeLocation;
|
|
15
|
+
if (['canvas-2d', 'webgl', 'mixed'].includes(kind)) {
|
|
16
|
+
canvas = document.createElement('canvas'); stage.append(canvas);
|
|
17
|
+
canvas.width = 1920 * devicePixelRatio; canvas.height = 1080 * devicePixelRatio;
|
|
18
|
+
if (kind === 'canvas-2d') ctx = canvas.getContext('2d', { alpha: false, colorSpace: 'srgb' });
|
|
19
|
+
else {
|
|
20
|
+
gl = canvas.getContext('webgl', { alpha: kind === 'mixed', premultipliedAlpha: true, antialias: true, preserveDrawingBuffer: true });
|
|
21
|
+
if (!gl) throw Error('WebGL unavailable');
|
|
22
|
+
const shader = (type, source) => { const s = gl.createShader(type); gl.shaderSource(s, source); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw Error(gl.getShaderInfoLog(s)); return s; };
|
|
23
|
+
program = gl.createProgram();
|
|
24
|
+
gl.attachShader(program, shader(gl.VERTEX_SHADER, 'attribute vec2 p;void main(){gl_Position=vec4(p,0.,1.);}'));
|
|
25
|
+
gl.attachShader(program, shader(gl.FRAGMENT_SHADER, `precision highp float;uniform float t;uniform vec2 size;void main(){vec2 p=gl_FragCoord.xy/size;float stripe=step(.5,fract((p.x+p.y)*12.+t));gl_FragColor=vec4(.15+.55*p.x,.2+.5*p.y,.25+.4*stripe,${kind === 'mixed' ? '.5' : '1.'});}`));
|
|
26
|
+
gl.linkProgram(program); if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw Error(gl.getProgramInfoLog(program));
|
|
27
|
+
gl.useProgram(program); const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER,b); gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),gl.STATIC_DRAW);
|
|
28
|
+
const loc=gl.getAttribLocation(program,'p');gl.enableVertexAttribArray(loc);gl.vertexAttribPointer(loc,2,gl.FLOAT,false,0,0);
|
|
29
|
+
gl.uniform2f(gl.getUniformLocation(program,'size'),canvas.width,canvas.height);timeLocation=gl.getUniformLocation(program,'t');gl.viewport(0,0,canvas.width,canvas.height);
|
|
30
|
+
window.BENCH_GL = gl;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
window.SHOT = {
|
|
34
|
+
duration: 2, fps: 30, ready: document.fonts.load('16px Bench'),
|
|
35
|
+
render(t) {
|
|
36
|
+
for (let i=0;i<tiles.length;i++) tiles[i].style.transform=`translate(${Math.sin(t*3+i)*20}px,${Math.cos(t*2+i)*10}px)`;
|
|
37
|
+
if(ctx){
|
|
38
|
+
// Capture can temporarily change DPR; use the fixed backing-store dimensions.
|
|
39
|
+
ctx.setTransform(canvas.width/1920,0,0,canvas.height/1080,0,0);ctx.fillStyle='#18202c';ctx.fillRect(0,0,1920,1080);
|
|
40
|
+
for(let i=0;i<160;i++){ctx.fillStyle=`hsl(${i*17%360} 60% 60%)`;ctx.beginPath();ctx.arc((i%20)*96+48+Math.sin(t*3+i)*20,Math.floor(i/20)*130+65,28+i%9,0,Math.PI*2);ctx.fill();}
|
|
41
|
+
ctx.fillStyle='#ffffff80';ctx.fillRect(300+t*100,250,600,400);
|
|
42
|
+
}
|
|
43
|
+
if(gl){gl.uniform1f(timeLocation,t);gl.drawArrays(gl.TRIANGLES,0,6);gl.finish();}
|
|
44
|
+
}
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html><head><meta charset="utf-8"><link rel="icon" href="data:,"><title>webgl</title><style>@font-face{font-family:Bench;src:url('../../../examples/assets/Roboto-Variable.ttf')}html,body{margin:0}#stage{width:1920px;height:1080px;position:relative;overflow:hidden;background:#18202c}canvas{position:absolute;inset:0;width:1920px;height:1080px}.tile{position:absolute;color:#fff;background:#375575;font:16px Bench;padding:4px;box-shadow:2px 3px 5px #0008}</style></head><body><div id="stage" data-kind="webgl"></div><script src="scene.js"></script></body></html>
|
|
1
|
+
<!doctype html><html><head><meta charset="utf-8"><link rel="icon" href="data:,"><title>webgl</title><style>@font-face{font-family:Bench;src:url('../../../examples/assets/Roboto-Variable.ttf')}html,body{margin:0}#stage{width:1920px;height:1080px;position:relative;overflow:hidden;background:#18202c}canvas{position:absolute;inset:0;width:1920px;height:1080px}.tile{position:absolute;color:#fff;background:#375575;font:16px Bench;padding:4px;box-shadow:2px 3px 5px #0008}</style></head><body><div id="stage" data-kind="webgl"></div><script src="scene.js"></script></body></html>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { existsSync } from 'node:fs';
|
|
5
|
-
|
|
6
|
-
if (!process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD) {
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
const playwrightRequire = createRequire(require.resolve('playwright/package.json'));
|
|
9
|
-
// Avoid taking Playwright's installation lock when both pinned browsers already exist.
|
|
10
|
-
const { registry: { registry } } = playwrightRequire('playwright-core/lib/coreBundle');
|
|
11
|
-
const installed = ['chromium', 'chromium-headless-shell'].every(name => existsSync(registry.findExecutable(name).executablePath()));
|
|
12
|
-
if (installed) process.exit(0);
|
|
13
|
-
const result = spawnSync(process.execPath, [path.join(path.dirname(require.resolve('playwright/package.json')), 'cli.js'), 'install', 'chromium'],
|
|
14
|
-
{ stdio: 'inherit', windowsHide: true });
|
|
15
|
-
if (result.error) throw result.error;
|
|
16
|
-
if (process.platform === 'linux') console.error('If Chromium cannot launch because system libraries are missing, run npx playwright install-deps chromium.');
|
|
17
|
-
process.exitCode = result.status ?? 1;
|
|
18
|
-
}
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
|
|
6
|
+
if (!process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD) {
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const playwrightRequire = createRequire(require.resolve('playwright/package.json'));
|
|
9
|
+
// Avoid taking Playwright's installation lock when both pinned browsers already exist.
|
|
10
|
+
const { registry: { registry } } = playwrightRequire('playwright-core/lib/coreBundle');
|
|
11
|
+
const installed = ['chromium', 'chromium-headless-shell'].every(name => existsSync(registry.findExecutable(name).executablePath()));
|
|
12
|
+
if (installed) process.exit(0);
|
|
13
|
+
const result = spawnSync(process.execPath, [path.join(path.dirname(require.resolve('playwright/package.json')), 'cli.js'), 'install', 'chromium'],
|
|
14
|
+
{ stdio: 'inherit', windowsHide: true });
|
|
15
|
+
if (result.error) throw result.error;
|
|
16
|
+
if (process.platform === 'linux') console.error('If Chromium cannot launch because system libraries are missing, run npx playwright install-deps chromium.');
|
|
17
|
+
process.exitCode = result.status ?? 1;
|
|
18
|
+
}
|