layershift 0.4.0 → 0.4.1

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 (2) hide show
  1. package/README.md +46 -43
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,30 +4,42 @@
4
4
 
5
5
  Embeddable video effects as Web Components. One script tag, one custom element — works in plain HTML, React, Vue, Svelte, Angular, WordPress, and anywhere else.
6
6
 
7
- Layershift is a growing collection of visual effects that turn flat video into something interactive. Each effect ships as its own custom element under the `layershift-*` namespace.
7
+ Layershift is a growing collection of visual effects that turn flat video into something interactive. Effects are configured via a `filter-config.json` file authored in the [Layershift Editor](https://layershift.io/editor/).
8
8
 
9
- ## Effects
10
-
11
- ### `<layershift-parallax>` — Depth-Aware Parallax Video
12
-
13
- A precomputed depth map drives per-pixel UV displacement with Parallax Occlusion Mapping (POM), so near objects move more than far objects — creating a convincing 3D effect from a single 2D video.
9
+ ## Quick Start
14
10
 
15
11
  ```html
16
- <script src="https://cdn.layershift.io/layershift.js"></script>
12
+ <script src="https://unpkg.com/layershift"></script>
17
13
 
18
- <layershift-parallax
14
+ <layershift-effect
19
15
  src="video.mp4"
20
16
  depth-src="depth-data.bin"
21
17
  depth-meta="depth-meta.json"
22
- ></layershift-parallax>
18
+ config="filter-config.json"
19
+ ></layershift-effect>
23
20
  ```
24
21
 
22
+ **[Live demo →](https://layershift.io)**
23
+
24
+ ## Effects
25
+
26
+ The `<layershift-effect>` element supports multiple effect types, all driven by the same depth data:
27
+
28
+ - **Depth Parallax** — per-pixel UV displacement via Parallax Occlusion Mapping
29
+ - **Depth Glow** — depth-driven emissive glow
30
+ - **Color Grade** — depth-aware color grading
31
+ - **Fog / Atmosphere** — depth-based atmospheric haze
32
+ - **Tilt Shift** — miniature/diorama lens effect
33
+ - **Pop-Out** — foreground subjects break out of the frame
34
+
35
+ Effects are configured in the [Layershift Editor](https://layershift.io/editor/) and exported as a `filter-config.json` file.
36
+
25
37
  ### `<layershift-portal>` — Logo Depth Portal
26
38
 
27
39
  Renders video through an SVG-shaped cutout with depth-aware parallax, emissive interior compositing, geometric chamfer lighting, and dimensional boundary effects. The canvas background is fully transparent, so the portal can be overlaid on any HTML content.
28
40
 
29
41
  ```html
30
- <script src="https://cdn.layershift.io/layershift.js"></script>
42
+ <script src="https://unpkg.com/layershift"></script>
31
43
 
32
44
  <layershift-portal
33
45
  src="video.mp4"
@@ -37,8 +49,6 @@ Renders video through an SVG-shaped cutout with depth-aware parallax, emissive i
37
49
  ></layershift-portal>
38
50
  ```
39
51
 
40
- **[Live demo →](https://layershift.io)**
41
-
42
52
  ---
43
53
 
44
54
  ## Install
@@ -46,7 +56,7 @@ Renders video through an SVG-shaped cutout with depth-aware parallax, emissive i
46
56
  ### Script Tag (IIFE)
47
57
 
48
58
  ```html
49
- <script src="https://cdn.layershift.io/layershift.js"></script>
59
+ <script src="https://unpkg.com/layershift"></script>
50
60
  ```
51
61
 
52
62
  ### npm
@@ -57,7 +67,7 @@ npm install layershift
57
67
 
58
68
  ```js
59
69
  import 'layershift';
60
- // Both <layershift-parallax> and <layershift-portal> are now registered
70
+ // <layershift-effect> and <layershift-portal> are now registered
61
71
  ```
62
72
 
63
73
  ### TypeScript
@@ -71,31 +81,21 @@ Add JSX type support for the custom elements:
71
81
 
72
82
  ---
73
83
 
74
- ## Prerequisites
75
-
76
- The `precompute` script needs **FFmpeg** to read video metadata and extract frames.
77
-
78
- - **macOS:** `brew install ffmpeg`
79
- - **Windows:** [FFmpeg downloads](https://ffmpeg.org/download.html) or `winget install FFmpeg`
80
- - **Linux:** `apt install ffmpeg` / `dnf install ffmpeg`
84
+ ## Prepare Your Video
81
85
 
82
- ## Setup
86
+ Use the [Layershift Editor](https://layershift.io/editor/) to:
83
87
 
84
- ```bash
85
- npm install
86
- ```
88
+ 1. Import a video or image
89
+ 2. Run browser-based depth estimation (no CLI needed)
90
+ 3. Configure your effect with the visual editor
91
+ 4. Export a consumer package with all assets + config
87
92
 
88
- ## Precompute Depth Data
89
-
90
- ```bash
91
- npm run precompute
92
- ```
93
-
94
- Generates `depth-data.bin` and `depth-meta.json` from a video using Depth Anything v2.
93
+ The editor produces `depth-data.bin`, `depth-meta.json`, and `filter-config.json` — everything `<layershift-effect>` needs.
95
94
 
96
95
  ## Development
97
96
 
98
97
  ```bash
98
+ npm install
99
99
  npm run dev
100
100
  ```
101
101
 
@@ -126,19 +126,22 @@ Components follow atomic design (Atoms → Molecules → Organisms → Templates
126
126
 
127
127
  ---
128
128
 
129
- ## `<layershift-parallax>` Reference
129
+ ## `<layershift-effect>` Reference
130
130
 
131
131
  ### Configuration
132
132
 
133
133
  | Attribute | Type | Default | Description |
134
134
  |-----------|------|---------|-------------|
135
- | `src` | string | — | Video file URL (required) |
135
+ | `src` | string | — | Video or image URL (required) |
136
136
  | `depth-src` | string | — | Depth binary URL (required) |
137
137
  | `depth-meta` | string | — | Depth metadata URL (required) |
138
+ | `config` | string | — | Filter config JSON URL |
138
139
  | `parallax-x` | number | 0.4 | Horizontal parallax intensity |
139
140
  | `parallax-y` | number | 1.0 | Vertical parallax intensity |
140
141
  | `parallax-max` | number | 30 | Max pixel offset for nearest layer |
141
142
  | `overscan` | number | 0.05 | Extra padding ratio |
143
+ | `quality` | string | auto | Quality tier: `auto`, `high`, `medium`, `low` |
144
+ | `source-type` | string | video | Source type: `video`, `image`, `camera` |
142
145
  | `autoplay` | boolean | true | Auto-play on mount |
143
146
  | `loop` | boolean | true | Loop playback |
144
147
  | `muted` | boolean | true | Muted (required for autoplay) |
@@ -147,24 +150,24 @@ Components follow atomic design (Atoms → Molecules → Organisms → Templates
147
150
 
148
151
  | Event | Detail | When |
149
152
  |-------|--------|------|
150
- | `layershift-parallax:ready` | `{ videoWidth, videoHeight, duration }` | Initialization complete |
151
- | `layershift-parallax:play` | `{ currentTime }` | Video starts playing |
152
- | `layershift-parallax:pause` | `{ currentTime }` | Video pauses |
153
- | `layershift-parallax:loop` | `{ loopCount }` | Video loops back to start |
154
- | `layershift-parallax:frame` | `{ currentTime, frameNumber }` | New video frame presented |
155
- | `layershift-parallax:error` | `{ message }` | Initialization error |
153
+ | `layershift-effect:ready` | `{ videoWidth, videoHeight, duration }` | Initialization complete |
154
+ | `layershift-effect:play` | `{ currentTime }` | Video starts playing |
155
+ | `layershift-effect:pause` | `{ currentTime }` | Video pauses |
156
+ | `layershift-effect:loop` | `{ loopCount }` | Video loops back to start |
157
+ | `layershift-effect:frame` | `{ currentTime, frameNumber }` | New video frame presented |
158
+ | `layershift-effect:error` | `{ message }` | Initialization error |
156
159
 
157
160
  ```js
158
- const el = document.querySelector('layershift-parallax');
161
+ const el = document.querySelector('layershift-effect');
159
162
 
160
- el.addEventListener('layershift-parallax:ready', (e) => {
163
+ el.addEventListener('layershift-effect:ready', (e) => {
161
164
  console.log(`Video: ${e.detail.videoWidth}x${e.detail.videoHeight}`);
162
165
  });
163
166
  ```
164
167
 
165
168
  ### Performance
166
169
 
167
- Each `<layershift-parallax>` instance creates 1 WebGL renderer, 1 Web Worker, 1 hidden `<video>` element, and 2 GPU textures (1 draw call per frame). The bilateral filter runs entirely off the main thread.
170
+ Each `<layershift-effect>` instance creates 1 WebGL renderer, 1 Web Worker, 1 hidden `<video>` element, and 2 GPU textures (1 draw call per frame). The bilateral filter runs entirely off the main thread.
168
171
 
169
172
  | Instances | Suitability |
170
173
  |-----------|-------------|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layershift",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Embeddable video effects as Web Components. Drop-in parallax, depth-aware motion, and more.",
5
5
  "type": "module",
6
6
  "main": "dist/components/layershift.js",