@pixerate/flair 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pixerate/flair
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a03bc70: Catalog: 35 new effects and two new categories.
8
+
9
+ - **overlay** (new category): rain on glass, snowfall, lens flare, vignette & grain, scanline sweep, spotlight, embers, shine sweep and frost creep shaders, plus a viewfinder vector effect. Overlay shaders have `transparent: true` (a new `ShaderEffect` field): render them with `{ alpha: true }` to lay them over other content.
10
+ - **image**: Ken Burns, ASCII art, shatter, melt, risograph, thermal / night vision, edge glow, tilt-shift, slit-scan, mosaic flip, chromatic lens and oil paint.
11
+ - **text** (new category): typewriter, scramble text, kinetic stagger, neon sign, stroke draw text, split reveal, highlighter, word cycle, liquid fill, glitch text and extruded text vector effects, and a `shader-text` shader that fills letters with plasma, fire, caustics or chrome. Drip text moves here from `icon`.
12
+ - `textImage(text, options)` in `/catalog`: any Unicode text as a transparent SVG `data:` URL, for image controls such as `shader-text`'s.
13
+ - Vector motion: `SvgAnimation.write` writes text letter by letter, with `scramble` (unwritten letters cycle through random characters) and `caret`; `writtenText` and `SCRAMBLE_MS` are exported from `/vector`.
14
+
3
15
  ## 0.7.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -19,13 +19,13 @@ Flair gives products a library of good-looking, configurable visual effects (her
19
19
 
20
20
  ### Core Capabilities
21
21
 
22
- - 🎨 **Effect catalog (`@pixerate/flair/catalog`)**: 63 effects, each with controls and presets. There are 46 WebGL2 shaders (gradients, organic textures, patterns, light, space, retro, image effects, transitions) and 17 animated SVG effects (loaders, status icons, titles, charts, counters, node graphs). [Browse them live](https://pixerate.github.io/flair/).
22
+ - 🎨 **Effect catalog (`@pixerate/flair/catalog`)**: 98 effects, each with controls and presets. There are 68 WebGL2 shaders (gradients, organic textures, patterns, light, space, retro, image treatments, transparent overlays, text fills, transitions) and 30 animated SVG effects (loaders, status icons, animated titles, charts, counters, node graphs). [Browse them live](https://pixerate.github.io/flair/).
23
23
  - ⚡ **Shader engine**:
24
24
  - Shadertoy-style GLSL ES 3.00 fragment shaders, with controls declared in the source (`// @control`), including image inputs.
25
25
  - Compile errors come back with line numbers that match the source.
26
26
  - Live previews (`ShaderRenderer`, with optional `{ alpha: true }` for transparent overlays) and many animated or hover-activated thumbnails on one context (`ThumbnailPool`).
27
27
  - Frames at exact times (`ShaderFrames`), looping GIFs, and standalone HTML pages.
28
- - ✒️ **Vector motion (`@pixerate/flair/vector`)**: animated SVG described as data. Catalog vector effects declare their controls in the picture (`{{name: type …}}`), text included. It covers attribute tweens, draw-on strokes, motion along paths, counters (`animateCount` / `formatCount` for DOM elements too) and view zooms. Every frame is a pure function of time (`svgFrame`), and `SvgPlayer` plays it (with `scrollTrigger`, `hideWhenPaused`, and `reset()`).
28
+ - ✒️ **Vector motion (`@pixerate/flair/vector`)**: animated SVG described as data. Catalog vector effects declare their controls in the picture (`{{name: type …}}`), text included. It covers attribute tweens, draw-on strokes, motion along paths, counters (`animateCount` / `formatCount` for DOM elements too), text written letter by letter (`write`, with `scramble` and `caret`) and view zooms. Every frame is a pure function of time (`svgFrame`), and `SvgPlayer` plays it (with `scrollTrigger`, `hideWhenPaused`, and `reset()`).
29
29
  - 🎛️ **Effect editor (`@pixerate/flair/editor`)**:
30
30
  - A headless editor for an effect's source, values, keyframes, presets and timeline.
31
31
  - Built on [`@pixerate/editor`](https://github.com/Pixerate/editor)'s undo history and command registry, with no UI framework assumed.
@@ -41,7 +41,7 @@ Flair gives products a library of good-looking, configurable visual effects (her
41
41
  | Import | What it provides | Runtime dependencies |
42
42
  | :--- | :--- | :--- |
43
43
  | `@pixerate/flair` | Shader engine, vector motion, time and easing, colour, blending, transitions, scenes, interchange exporters | None (browser-safe) |
44
- | `@pixerate/flair/catalog` | `EFFECTS`, `getEffect`, `findEffects`, `effectDefaults`, `renderVectorEffect`, `vectorControls`, GLSL helpers, sample images | None |
44
+ | `@pixerate/flair/catalog` | `EFFECTS`, `getEffect`, `findEffects`, `effectDefaults`, `renderVectorEffect`, `vectorControls`, GLSL helpers, sample images, `textImage` | None |
45
45
  | `@pixerate/flair/vector` | `SvgMotion`, `svgFrame`, `svgView`, `SvgPlayer`, `animateCount`, `formatCount`, `svgMotionIssues` | None |
46
46
  | `@pixerate/flair/editor` | `EffectEditor`, effect documents, keyframe tracks, renderer bindings, parameter-panel binding, agent tools and instructions | `@pixerate/editor` ≥ 0.29 (optional peer; only its dependency-free `/history`, `/commands`, `/tools`, `/animation` and `/parameters` subpaths) |
47
47
  | `@pixerate/flair/node` | `exportMotionGraphic`: renders a shader to GIF/MP4 through headless Chrome and ffmpeg | Node.js |
@@ -55,7 +55,7 @@ The `flair` CLI inspects shaders, writes standalone pages and directs scenes (se
55
55
  ```mermaid
56
56
  graph TD
57
57
  subgraph Effects["Effects (no dependencies)"]
58
- Catalog["catalog: 63 effects + presets"]
58
+ Catalog["catalog: 98 effects + presets"]
59
59
  Shader["shader engine: controls, compile, render, GIF, HTML"]
60
60
  Vector["vector motion: SvgMotion, SvgPlayer"]
61
61
  Time["time: clocks, easing, keyframes, noise"]
@@ -100,7 +100,7 @@ npm install @pixerate/editor-react
100
100
  import { ShaderRenderer, SvgPlayer, ThumbnailPool, animateCount } from "@pixerate/flair";
101
101
  import { getEffect, effectDefaults, renderVectorEffect } from "@pixerate/flair/catalog";
102
102
 
103
- // A shader background (or pass { alpha: true } with uBackgroundAlpha: 0 for a transparent overlay)
103
+ // A shader background (overlay effects have `transparent: true`: render them with { alpha: true })
104
104
  const aurora = getEffect("aurora")!;
105
105
  if (aurora.kind === "shader") {
106
106
  const preview = new ShaderRenderer(document.querySelector("#hero")!);
@@ -131,6 +131,8 @@ animateCount({
131
131
 
132
132
  Find effects with `findEffects({ text: "glow", category: "light", kind: "shader" })`. Each effect has an `id`, `name`, `description`, `category`, `tags` and optional `presets`. Image effects default to built-in sample pictures, so they look right before you set `uImage` to your own URL.
133
133
 
134
+ Overlay shaders (`category: "overlay"`) have `transparent: true`: they write coverage to `fragColor.a` and draw nothing elsewhere, so render them with `new ShaderRenderer(host, { alpha: true })` (or `new ThumbnailPool({ alpha: true })`) and lay the canvas over a picture, video or page. `shader-text` fills letters from a text image: set its `uText` control to `textImage("Your title", { weight: 900 })`, a transparent SVG `data:` URL of any Unicode text.
135
+
134
136
  A vector effect declares its controls in its picture, the way a shader declares its uniforms: the first `{{name: type …}}` declares a control (`float`, `int`, `bool`, `color` or `text`, with `@control`'s attributes; quote values with spaces in single quotes), and every `{{name}}` is filled with its value. Declarations can sit in an XML comment, which is dropped when the picture is filled in, and text is escaped, so any words are safe:
135
137
 
136
138
  ```ts
@@ -265,9 +267,11 @@ The exporters carry the camera too:
265
267
  | pattern | dot wave, Truchet flow, hex pulse, living cells, moiré rings, kaleidoscope, stripes, neon circuit |
266
268
  | light / space | bokeh, god rays, sparkles, neon ripple, light ribbons, warp starfield, nebula, event horizon |
267
269
  | retro | synthwave, digital rain, dithered gradient, TV static |
268
- | image | ripple, glitch, duotone, halftone, pixel reveal, CRT screen, film look |
270
+ | image | ripple, glitch, duotone, halftone, pixel reveal, Ken Burns, ASCII art, shatter, melt, risograph, thermal, edge glow, tilt-shift, slit-scan, mosaic flip, chromatic lens, oil paint, CRT screen, film look |
271
+ | overlay | rain on glass, snowfall, lens flare, vignette & grain, scanline sweep, spotlight, embers, shine sweep, frost creep, viewfinder |
272
+ | text | shader text, drip text, typewriter, scramble text, kinetic stagger, neon sign, stroke draw text, split reveal, highlighter, word cycle, liquid fill, glitch text, extruded text |
269
273
  | transition | wipe, iris, block dissolve, grid wipe, glass wipe, twister, light leak, cross zoom |
270
- | loader / icon / data | spinner, bouncing dots, pulse ping, equalizer, progress ring, bar chart, line chart, stat counter, route, success check, error cross, heartbeat, signature, confetti, drip text, flow network |
274
+ | loader / icon / data | spinner, bouncing dots, pulse ping, equalizer, progress ring, bar chart, line chart, stat counter, route, timeline track, success check, error cross, heartbeat, signature, confetti, flow network |
271
275
 
272
276
  Every shader is self-contained and compiles on WebGL2. Open [`#check`](https://pixerate.github.io/flair/#check) on the demo to compile the catalog on your own GPU.
273
277
 
@@ -1,7 +1,7 @@
1
1
  import { a as ControlDef, C as ControlValue } from '../controls-Syr6drzO.js';
2
- import { E as EffectDefinition, a as EffectCategory, S as ShaderEffect } from '../types-CfIFlnMY.js';
3
- export { b as EFFECT_CATEGORIES, c as EffectPreset, V as VECTOR_CONTROL_TYPES, d as VectorControl, e as VectorEffect, f as colorControl, n as numberControl, r as renderVectorEffect, v as vectorControlDef, g as vectorControlIssues, h as vectorControls, i as vectorEffectControls } from '../types-CfIFlnMY.js';
4
- import '../motion-BwIlugh1.js';
2
+ import { E as EffectDefinition, a as EffectCategory, S as ShaderEffect } from '../types-CNPIrnTf.js';
3
+ export { b as EFFECT_CATEGORIES, c as EffectPreset, V as VECTOR_CONTROL_TYPES, d as VectorControl, e as VectorEffect, f as colorControl, n as numberControl, r as renderVectorEffect, v as vectorControlDef, g as vectorControlIssues, h as vectorControls, i as vectorEffectControls } from '../types-CNPIrnTf.js';
4
+ import '../motion-Ce0lmzm3.js';
5
5
 
6
6
  /**
7
7
  * Sample pictures for the catalog's image effects: small SVGs as `data:` URLs,
@@ -15,6 +15,26 @@ declare const SAMPLE_IMAGES: {
15
15
  readonly city: string;
16
16
  readonly portrait: string;
17
17
  };
18
+ interface TextImageOptions {
19
+ /** CSS font family (default a heavy system sans-serif). */
20
+ font?: string;
21
+ /** Font weight (default 900). */
22
+ weight?: number | string;
23
+ /** Font size in the picture's units; by default as large as fits. */
24
+ size?: number;
25
+ /** The picture's size (default 1024 × 256). */
26
+ width?: number;
27
+ height?: number;
28
+ }
29
+ /**
30
+ * A line of text, white on transparent, as an SVG `data:` URL for an image
31
+ * control (the shader text effects use its alpha as a letter mask). The text
32
+ * is centred and fitted to the picture (1024 × 256 by default): the font
33
+ * size comes from its length, and `textLength` stretches it to the width
34
+ * that size predicts, so any text fills about the same box in any font.
35
+ * Takes any Unicode text.
36
+ */
37
+ declare function textImage(text: string, options?: TextImageOptions): string;
18
38
 
19
39
  /**
20
40
  * GLSL helpers the catalog's shaders are built from. Each effect's source
@@ -72,4 +92,4 @@ declare function effectDefaults(effect: EffectDefinition, options?: {
72
92
  values?: Record<string, ControlValue>;
73
93
  }): Record<string, ControlValue>;
74
94
 
75
- export { EFFECTS, EffectCategory, EffectDefinition, type EffectQuery, FBM, HASH, NOISE, OKLAB_MIX, PALETTE, ROTATE, SAMPLE_IMAGES, SHADER_EFFECTS, ShaderEffect, effectControls, effectDefaults, findEffects, getEffect, glsl, svgDataUrl };
95
+ export { EFFECTS, EffectCategory, EffectDefinition, type EffectQuery, FBM, HASH, NOISE, OKLAB_MIX, PALETTE, ROTATE, SAMPLE_IMAGES, SHADER_EFFECTS, ShaderEffect, effectControls, effectDefaults, findEffects, getEffect, glsl, svgDataUrl, textImage };
@@ -19,11 +19,12 @@ import {
19
19
  numberControl,
20
20
  renderVectorEffect,
21
21
  svgDataUrl,
22
+ textImage,
22
23
  vectorControlDef,
23
24
  vectorControlIssues,
24
25
  vectorControls,
25
26
  vectorEffectControls
26
- } from "../chunk-J2WIWT4J.js";
27
+ } from "../chunk-FHXOMIQY.js";
27
28
  import "../chunk-EHDJ3CPJ.js";
28
29
  import "../chunk-WC3VADZC.js";
29
30
  export {
@@ -47,6 +48,7 @@ export {
47
48
  numberControl,
48
49
  renderVectorEffect,
49
50
  svgDataUrl,
51
+ textImage,
50
52
  vectorControlDef,
51
53
  vectorControlIssues,
52
54
  vectorControls,