layershift 0.6.0 → 0.8.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.
- package/README.md +18 -9
- package/dist/components/layershift.js +31 -31
- package/dist/npm/layershift.es.js +687 -496
- package/dist/types/components/layershift/global.d.ts +4 -4
- package/dist/types/components/layershift/index.d.ts +1 -1
- package/dist/types/components/layershift/layershift-element.d.ts +13 -1
- package/dist/types/components/layershift/layershift-element.d.ts.map +1 -1
- package/dist/types/components/layershift/lifecycle.d.ts +1 -1
- package/dist/types/components/layershift/lifecycle.d.ts.map +1 -1
- package/dist/types/components/layershift/portal-element.d.ts +1 -1
- package/dist/types/components/layershift/portal-element.d.ts.map +1 -1
- package/dist/types/components/layershift/types.d.ts +8 -8
- package/dist/types/components/layershift/types.d.ts.map +1 -1
- package/dist/types/depth/create-depth-session.d.ts +11 -0
- package/dist/types/depth/create-depth-session.d.ts.map +1 -0
- package/dist/types/depth/depth-estimator.d.ts.map +1 -1
- package/dist/types/depth/precomputed-depth.d.ts +36 -1
- package/dist/types/depth/precomputed-depth.d.ts.map +1 -1
- package/dist/types/renderers/renderer-base.d.ts +16 -0
- package/dist/types/renderers/renderer-base.d.ts.map +1 -1
- package/dist/types/shared/filter-config.d.ts +2 -2
- package/dist/types/shared/filter-config.d.ts.map +1 -1
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Layershift is a growing collection of visual effects that turn flat video into s
|
|
|
13
13
|
|
|
14
14
|
<layershift-effect
|
|
15
15
|
src="video.mp4"
|
|
16
|
-
|
|
16
|
+
map-src="video.lsb"
|
|
17
17
|
config="filter-config.json"
|
|
18
18
|
></layershift-effect>
|
|
19
19
|
```
|
|
@@ -24,9 +24,9 @@ Layershift is a growing collection of visual effects that turn flat video into s
|
|
|
24
24
|
|
|
25
25
|
The `<layershift-effect>` element supports multiple effect types, all driven by the same depth data:
|
|
26
26
|
|
|
27
|
-
- **
|
|
27
|
+
- **Parallax** — per-pixel UV displacement via Parallax Occlusion Mapping
|
|
28
28
|
- **Rack Focus** — animated focus shift between depth layers
|
|
29
|
-
- **
|
|
29
|
+
- **Glow** — depth-driven emissive glow
|
|
30
30
|
- **Color Grade** — depth-aware color grading
|
|
31
31
|
- **Fog / Atmosphere** — depth-based atmospheric haze
|
|
32
32
|
- **Tilt Shift** — miniature/diorama lens effect
|
|
@@ -76,7 +76,7 @@ Use the [Layershift Editor](https://layershift.io/editor/) to:
|
|
|
76
76
|
3. Configure your effect with the visual editor
|
|
77
77
|
4. Export a consumer package with all assets + config
|
|
78
78
|
|
|
79
|
-
The editor produces `
|
|
79
|
+
The editor produces `video.lsb` and `filter-config.json` — everything `<layershift-effect>` needs.
|
|
80
80
|
|
|
81
81
|
## Development
|
|
82
82
|
|
|
@@ -128,11 +128,11 @@ Components follow atomic design (Atoms → Molecules → Organisms → Templates
|
|
|
128
128
|
| Attribute | Type | Default | Description |
|
|
129
129
|
|-----------|------|---------|-------------|
|
|
130
130
|
| `src` | string | — | Video or image URL (required) |
|
|
131
|
-
| `
|
|
131
|
+
| `map-src` | string | — | Depth map URL — `.lsb` file in LSFT format (required unless `depth-model` is set) |
|
|
132
132
|
| `config` | string | — | Filter config JSON URL (authored in the editor) |
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
133
|
+
| `map-width` | number | 512 | Width of depth map frames (optional — read from `.lsb` header) |
|
|
134
|
+
| `map-height` | number | 512 | Height of depth map frames (optional — read from `.lsb` header) |
|
|
135
|
+
| `map-fps` | number | 5 | Frame rate of precomputed depth data (optional — read from `.lsb` header) |
|
|
136
136
|
| `depth-model` | string | — | ONNX model URL for browser-side depth estimation |
|
|
137
137
|
| `source-type` | string | video | Source type: `video`, `image`, `camera` (experimental) |
|
|
138
138
|
| `quality` | string | auto | Quality tier: `auto`, `high`, `medium`, `low` |
|
|
@@ -245,7 +245,7 @@ const cleanup = connectPointer(el as HTMLElement & { input: EffectInput }, {
|
|
|
245
245
|
|
|
246
246
|
### Performance
|
|
247
247
|
|
|
248
|
-
Each `<layershift-effect>` instance creates 1 WebGL renderer, 1
|
|
248
|
+
Each `<layershift-effect>` instance creates 1 WebGL renderer, 1 hidden `<video>` element, and 2 GPU textures (1 draw call per frame). The bilateral filter runs as a GPU shader pass.
|
|
249
249
|
|
|
250
250
|
| Instances | Suitability |
|
|
251
251
|
|-----------|-------------|
|
|
@@ -255,6 +255,15 @@ Each `<layershift-effect>` instance creates 1 WebGL renderer, 1 Web Worker, 1 hi
|
|
|
255
255
|
|
|
256
256
|
---
|
|
257
257
|
|
|
258
|
+
## Depth Data
|
|
259
|
+
|
|
260
|
+
Effects are driven by per-frame depth maps stored in `.lsb` files (LSFT binary format):
|
|
261
|
+
|
|
262
|
+
- **Precomputed** — generated by the [Layershift Editor](https://layershift.io/editor/) or the [precompute CLI](https://github.com/jeremysykes/layershift-precompute-cli). Depth data is u8+deflate compressed (~0.5–2.7 MB per file). Dimensions, FPS, and frame count are embedded in the file header.
|
|
263
|
+
- **Browser estimation** — on-device ML inference via the `depth-model` attribute. No preprocessing needed.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
258
267
|
## Frame-Level Sync
|
|
259
268
|
|
|
260
269
|
`<layershift-effect>` uses `requestVideoFrameCallback` (RVFC) when available to sync depth updates to actual video frame presentation:
|