Skip to content

The VS Code of video editing, built for agents.

TypeScript

feat: add 'type' prop to mask for channel specification and update example usage

konstantin-paulus6a45d560d178
diff --git a/docs/reference/jsx/masks.md b/docs/reference/jsx/masks.md
index 43906176..de582eed 100644
--- a/docs/reference/jsx/masks.md
+++ b/docs/reference/jsx/masks.md
@@ -7,7 +7,7 @@ Two ways to cut an element, both as SVG has them: a **clip path** shows the elem
<clipPath>
<ellipse x={560} y={140} width={800} height={800} />
</clipPath>
- <mask>
+ <mask type="alpha">
<text fontSize={180} color="#FFFFFF">HELLO</text>
</mask>
<video src="footage/beach.mp4" width={1920} height={1080} />
@@ -51,6 +51,7 @@ Keeps only what its **picture** covers, by the picture's alpha: opaque keeps, tr
| Prop | Type | Default | Meaning |
| ---- | ---- | ------- | ------- |
+| `type` | `"alpha"` | `"alpha"` | Which channel of the picture cuts. Only `"alpha"` for now, its opacity; unlike SVG, whose masks default to luminance. |
| `inverted` | `boolean` | `false` | Covers what the picture does not instead. |
| `blur` | `number` | `0` | Feather: radius in px the edge falls off over. |
| `opacity` | `number` | `1` | How strongly the mask cuts, `0`–`1`. `1` leaves nothing outside it; lower lets that much through outside; `0` is no mask. |
@@ -77,7 +78,7 @@ A mask file is what the editor's object mask tool makes — pick an object in a
```tsx
<video src="footage/skater.mp4" width={1920} height={1080}>
<effect type="opacity" value={1}>
- <mask src="masks/skater" sourceIn={2} frameRate={30} blur={6} />
+ <mask src="masks/skater.mask" sourceIn={2} blur={6} />
</effect>
</video>
```
diff --git a/packages/jsx/src/types.ts b/packages/jsx/src/types.ts
index 0cfa582f..39dc5c59 100644
--- a/packages/jsx/src/types.ts
+++ b/packages/jsx/src/types.ts
@@ -765,6 +765,11 @@ export type ClipPathProps = Pick<CompositeProps, "hidden"> & {
* their time nor a `src` does nothing.
*/
export type MaskProps = Pick<CompositeProps, "hidden"> & {
+ /**
+ * Which channel of the picture cuts: `"alpha"`, its opacity. The only kind
+ * for now (unlike SVG, whose default is luminance). Default "alpha".
+ */
+ type?: "alpha";
/** The mask's frames: a directory of numbered images whose alpha is the mask. */
src?: string;
/** The parent's source time the first frame of `src` belongs to, so the frames stay on the footage they were made from whatever the trim. Default 0. */