@effing/effie 0.1.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/LICENSE +11 -0
- package/README.md +226 -0
- package/dist/index.d.ts +10472 -0
- package/dist/index.js +469 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
O'Saasy License
|
|
2
|
+
|
|
3
|
+
Copyright © 2026, Trackuity BV.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
2. No licensee or downstream recipient may use the Software (including any modified or derivative versions) to directly compete with the original Licensor by offering it to third parties as a hosted, managed, or Software-as-a-Service (SaaS) product or cloud service where the primary value of the service is the functionality of the Software itself.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# @effing/effie
|
|
2
|
+
|
|
3
|
+
**Declarative video composition format for programmatic video creation.**
|
|
4
|
+
|
|
5
|
+
> Part of the [**Effing**](../../README.md) family — programmatic video creation with TypeScript.
|
|
6
|
+
|
|
7
|
+
Define video compositions with typed segments, layers, transitions, effects, and motion — then render with `@effing/ffs`.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @effing/effie
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Concepts
|
|
16
|
+
|
|
17
|
+
### EffieData
|
|
18
|
+
|
|
19
|
+
The root structure describing a complete video composition:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
type EffieData = {
|
|
23
|
+
width: number; // Frame width in pixels
|
|
24
|
+
height: number; // Frame height in pixels
|
|
25
|
+
fps: number; // Frames per second
|
|
26
|
+
cover: EffieWebUrl; // Cover image URL
|
|
27
|
+
sources?: EffieSources; // Named source references (for reuse)
|
|
28
|
+
background: EffieBackground; // Video background
|
|
29
|
+
audio?: EffieAudio; // Global soundtrack
|
|
30
|
+
segments: EffieSegment[]; // Consecutive video segments
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Segments & Layers
|
|
35
|
+
|
|
36
|
+
Videos are composed of **segments** (consecutive time blocks) containing **layers** (stacked visual elements):
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
type EffieSegment = {
|
|
40
|
+
duration: number; // Duration in seconds
|
|
41
|
+
layers: EffieLayer[]; // Visual layers (bottom to top)
|
|
42
|
+
background?: EffieBackground; // Override global background for this segment
|
|
43
|
+
audio?: EffieAudio; // Segment-specific audio
|
|
44
|
+
transition?: EffieTransition; // Transition from previous segment
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type EffieLayer = {
|
|
48
|
+
type: "image" | "animation"; // PNG/JPEG or Annie TAR
|
|
49
|
+
source: EffieSource; // URL or #reference
|
|
50
|
+
delay?: number; // Delay before appearing
|
|
51
|
+
from?: number; // Show from this time
|
|
52
|
+
until?: number; // Show until this time
|
|
53
|
+
effects?: EffieEffect[]; // Visual effects (see below)
|
|
54
|
+
motion?: EffieMotion; // Motion animation (see below)
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Effects vs Motion
|
|
59
|
+
|
|
60
|
+
**Effects** and **Motion** serve different purposes:
|
|
61
|
+
|
|
62
|
+
| Aspect | Effects | Motion |
|
|
63
|
+
| ---------------- | ------------------------------------------ | ------------------------------------------- |
|
|
64
|
+
| **What it does** | Transforms the layer's visual appearance | Animates the layer's position on screen |
|
|
65
|
+
| **Examples** | Fade in/out, saturation, scrolling content | Bounce, shake, slide into view |
|
|
66
|
+
| **Technically** | Pixel filters applied to the layer source | X/Y coordinate animation during compositing |
|
|
67
|
+
|
|
68
|
+
A layer can have **multiple effects** (applied in sequence) but only **one motion** — you can fade in and saturate simultaneously, but a layer can only move in one way at a time.
|
|
69
|
+
|
|
70
|
+
### Source References
|
|
71
|
+
|
|
72
|
+
To avoid duplicating long URLs, define sources once and reference them with `#name`:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
const video = effieData({
|
|
76
|
+
sources: {
|
|
77
|
+
bg: "https://example.com/background.mp4",
|
|
78
|
+
music: "https://example.com/audio.mp3",
|
|
79
|
+
},
|
|
80
|
+
background: { type: "video", source: "#bg" },
|
|
81
|
+
audio: { source: "#music", volume: 0.8 },
|
|
82
|
+
// ...
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Quick Start
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { effieData, effieSegment, effieLayer } from "@effing/effie";
|
|
90
|
+
|
|
91
|
+
const video = effieData({
|
|
92
|
+
width: 1080,
|
|
93
|
+
height: 1920,
|
|
94
|
+
fps: 30,
|
|
95
|
+
cover: "https://example.com/cover.png",
|
|
96
|
+
background: { type: "color", color: "#1a1a2e" },
|
|
97
|
+
segments: [
|
|
98
|
+
effieSegment({
|
|
99
|
+
duration: 5,
|
|
100
|
+
layers: [
|
|
101
|
+
effieLayer({
|
|
102
|
+
type: "animation",
|
|
103
|
+
source: "https://example.com/intro.tar",
|
|
104
|
+
effects: [{ type: "fade-in", start: 0, duration: 1 }],
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
}),
|
|
108
|
+
effieSegment({
|
|
109
|
+
duration: 4,
|
|
110
|
+
transition: { type: "slide", direction: "left", duration: 0.5 },
|
|
111
|
+
layers: [
|
|
112
|
+
effieLayer({ type: "image", source: "https://example.com/slide.png" }),
|
|
113
|
+
],
|
|
114
|
+
}),
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API Overview
|
|
120
|
+
|
|
121
|
+
### Type Helpers
|
|
122
|
+
|
|
123
|
+
| Export | Description |
|
|
124
|
+
| ------------------- | ----------------------------- |
|
|
125
|
+
| `effieData()` | Create typed EffieData |
|
|
126
|
+
| `effieSegment()` | Create typed EffieSegment |
|
|
127
|
+
| `effieLayer()` | Create typed EffieLayer |
|
|
128
|
+
| `effieBackground()` | Create typed EffieBackground |
|
|
129
|
+
| `effieWebUrl()` | Validate and cast URL strings |
|
|
130
|
+
|
|
131
|
+
### Partitioning Helpers
|
|
132
|
+
|
|
133
|
+
For distributed rendering, split compositions into segments and join them back:
|
|
134
|
+
|
|
135
|
+
| Export | Description |
|
|
136
|
+
| ----------------------- | --------------------------------------------------- |
|
|
137
|
+
| `effieDataForSegment()` | Extract minimal data for rendering a single segment |
|
|
138
|
+
| `effieDataForJoin()` | Create data for joining pre-rendered segments |
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { effieDataForSegment, effieDataForJoin } from "@effing/effie";
|
|
142
|
+
|
|
143
|
+
// Split: get minimal effie data for each segment
|
|
144
|
+
const segmentEffie = effieDataForSegment(effieData, segmentIndex);
|
|
145
|
+
|
|
146
|
+
// After rendering segments, join them:
|
|
147
|
+
const joinEffie = effieDataForJoin(effieData, [
|
|
148
|
+
"https://example.com/seg0.mp4",
|
|
149
|
+
"https://example.com/seg1.mp4",
|
|
150
|
+
]);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Types
|
|
154
|
+
|
|
155
|
+
| Type | Description |
|
|
156
|
+
| ----------------- | -------------------------------------- |
|
|
157
|
+
| `EffieData` | Root video composition |
|
|
158
|
+
| `EffieSegment` | A time segment with layers |
|
|
159
|
+
| `EffieLayer` | An image or animation layer |
|
|
160
|
+
| `EffieBackground` | Color, image, or video background |
|
|
161
|
+
| `EffieTransition` | Transition between segments |
|
|
162
|
+
| `EffieEffect` | Layer effects (fade, saturate, scroll) |
|
|
163
|
+
| `EffieMotion` | Layer motion (bounce, shake, slide) |
|
|
164
|
+
| `EffieAudio` | Audio configuration |
|
|
165
|
+
| `EffieSources` | Named source map |
|
|
166
|
+
| `EffieSource` | URL or #reference |
|
|
167
|
+
|
|
168
|
+
## Transitions
|
|
169
|
+
|
|
170
|
+
Available transition types:
|
|
171
|
+
|
|
172
|
+
| Type | Properties | Description |
|
|
173
|
+
| ---------- | ---------------------- | ------------------ |
|
|
174
|
+
| `fade` | `easing?` or `through` | Crossfade variants |
|
|
175
|
+
| `barn` | `orientation`, `mode` | Barn door wipes |
|
|
176
|
+
| `circle` | `mode` | Circle wipes |
|
|
177
|
+
| `wipe` | `direction` | Wipe |
|
|
178
|
+
| `slide` | `direction` | Slide |
|
|
179
|
+
| `smooth` | `direction` | Smooth wipe |
|
|
180
|
+
| `slice` | `direction` | Slice |
|
|
181
|
+
| `zoom` | | Zoom |
|
|
182
|
+
| `dissolve` | | Dissolve |
|
|
183
|
+
| `pixelize` | | Pixelate |
|
|
184
|
+
| `radial` | | Radial wipe |
|
|
185
|
+
|
|
186
|
+
### Fade options
|
|
187
|
+
|
|
188
|
+
- `easing`: `"linear"` (default), `"ease-in"`, or `"ease-out"` — for direct crossfades
|
|
189
|
+
- `through`: `"black"`, `"white"`, or `"grays"` — fade through a color
|
|
190
|
+
|
|
191
|
+
### Circle options
|
|
192
|
+
|
|
193
|
+
- `mode`: `"open"` (default), `"close"`, or `"crop"`
|
|
194
|
+
|
|
195
|
+
### Barn door options
|
|
196
|
+
|
|
197
|
+
- `orientation`: `"horizontal"` (default) or `"vertical"`
|
|
198
|
+
- `mode`: `"open"` (default) or `"close"`
|
|
199
|
+
|
|
200
|
+
### Directional options (wipe, slide, smooth, slice)
|
|
201
|
+
|
|
202
|
+
- `direction`: `"left"` (default), `"right"`, `"up"`, or `"down"`
|
|
203
|
+
|
|
204
|
+
## Effects
|
|
205
|
+
|
|
206
|
+
| Type | Properties | Description |
|
|
207
|
+
| -------------- | ----------------------------------- | -------------- |
|
|
208
|
+
| `fade-in` | `start`, `duration` | Fade in |
|
|
209
|
+
| `fade-out` | `start`, `duration` | Fade out |
|
|
210
|
+
| `saturate-in` | `start`, `duration` | Saturation in |
|
|
211
|
+
| `saturate-out` | `start`, `duration` | Saturation out |
|
|
212
|
+
| `scroll` | `direction`, `distance`, `duration` | Scroll layer |
|
|
213
|
+
|
|
214
|
+
## Motion
|
|
215
|
+
|
|
216
|
+
| Type | Properties | Description |
|
|
217
|
+
| -------- | --------------------------------------------- | --------------- |
|
|
218
|
+
| `bounce` | `amplitude`, `start`, `duration` | Bouncing motion |
|
|
219
|
+
| `shake` | `intensity`, `frequency`, `start`, `duration` | Shake effect |
|
|
220
|
+
| `slide` | `direction`, `distance`, `reverse`, `easing` | Slide animation |
|
|
221
|
+
|
|
222
|
+
## Related Packages
|
|
223
|
+
|
|
224
|
+
- [`@effing/ffs`](../ffs) — Render Effie compositions to video
|
|
225
|
+
- [`@effing/effie-preview`](../effie-preview) — Preview compositions in the browser
|
|
226
|
+
- [`@effing/annie`](../annie) — Generate animations for layers
|