@twick/visualizer 0.14.2 → 0.14.3

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 (38) hide show
  1. package/README.md +104 -4
  2. package/package.json +8 -8
  3. package/package.json.bak +8 -8
  4. package/src/animations/blur.tsx +47 -11
  5. package/src/animations/breathe.tsx +44 -9
  6. package/src/animations/fade.tsx +126 -13
  7. package/src/animations/index.ts +12 -0
  8. package/src/animations/photo-rise.tsx +48 -11
  9. package/src/animations/photo-zoom.tsx +45 -9
  10. package/src/animations/rise.tsx +52 -13
  11. package/src/animations/succession.tsx +45 -10
  12. package/src/elements/audio.element.tsx +63 -1
  13. package/src/elements/caption.element.tsx +82 -0
  14. package/src/elements/circle.element.tsx +70 -2
  15. package/src/elements/icon.element.tsx +70 -2
  16. package/src/elements/image.element.tsx +81 -0
  17. package/src/elements/index.ts +14 -0
  18. package/src/elements/rect.element.tsx +72 -2
  19. package/src/elements/scene.element.tsx +87 -19
  20. package/src/elements/text.element.tsx +74 -0
  21. package/src/elements/video.element.tsx +220 -1
  22. package/src/frame-effects/circle.frame.tsx +77 -12
  23. package/src/frame-effects/index.ts +7 -0
  24. package/src/frame-effects/rect.frame.tsx +108 -13
  25. package/src/helpers/element.utils.ts +100 -8
  26. package/src/helpers/event.utils.ts +15 -0
  27. package/src/helpers/log.utils.ts +37 -11
  28. package/src/helpers/types.ts +119 -0
  29. package/src/helpers/utils.ts +17 -0
  30. package/src/index.ts +190 -0
  31. package/src/text-effects/elastic.tsx +39 -8
  32. package/src/text-effects/erase.tsx +42 -9
  33. package/src/text-effects/index.ts +9 -0
  34. package/src/text-effects/stream-word.tsx +43 -9
  35. package/src/text-effects/typewriter.tsx +43 -9
  36. package/src/visualizer-grouped.ts +83 -0
  37. package/src/visualizer.tsx +89 -5
  38. package/typedoc.json +8 -3
package/src/index.ts CHANGED
@@ -1,6 +1,196 @@
1
+ /**
2
+ * @twick/visualizer - Professional Video Visualization Library
3
+ *
4
+ * A comprehensive TypeScript library for creating dynamic video visualizations with
5
+ * animations, effects, and interactive elements. Built on top of @twick/2d and @twick/core
6
+ * for high-performance 2D graphics and animation.
7
+ *
8
+ * ## 🚀 Quick Start
9
+ *
10
+ * ```js
11
+ * import { scene } from '@twick/visualizer';
12
+ * import { makeScene2D } from '@twick/2d';
13
+ *
14
+ * // Create a video visualization
15
+ * const videoScene = makeScene2D("video-scene", function* (view) {
16
+ * yield* scene({
17
+ * backgroundColor: "#000000",
18
+ * playerId: "main-player",
19
+ * properties: { width: 1920, height: 1080 },
20
+ * tracks: [
21
+ * {
22
+ * id: "main-track",
23
+ * type: "video",
24
+ * elements: [
25
+ * {
26
+ * id: "intro-video",
27
+ * type: "video",
28
+ * s: 0,
29
+ * e: 10,
30
+ * props: { src: "intro.mp4" },
31
+ * animation: {
32
+ * name: "fade",
33
+ * animate: "enter",
34
+ * duration: 2
35
+ * }
36
+ * }
37
+ * ]
38
+ * }
39
+ * ]
40
+ * });
41
+ * });
42
+ * ```
43
+ *
44
+ * ## 🎯 Getting Started
45
+ *
46
+ * ### 1. Installation
47
+ * ```bash
48
+ * pnpm add @twick/visualizer @twick/2d @twick/core
49
+ * ```
50
+ *
51
+ * ### 2. Basic Usage
52
+ * ```js
53
+ * import { scene } from '@twick/visualizer';
54
+ * import { makeScene2D } from '@twick/2d';
55
+ *
56
+ * // Simple fade-in text
57
+ * const simpleScene = makeScene2D("simple", function* (view) {
58
+ * yield* scene({
59
+ * backgroundColor: "#1a1a1a",
60
+ * playerId: "simple-player",
61
+ * properties: { width: 1920, height: 1080 },
62
+ * tracks: [{
63
+ * id: "text-track",
64
+ * type: "element",
65
+ * elements: [{
66
+ * id: "welcome-text",
67
+ * type: "text",
68
+ * s: 0, e: 5,
69
+ * t: "Welcome!",
70
+ * props: {
71
+ * fill: "#ffffff",
72
+ * fontSize: 72,
73
+ * fontFamily: "Arial"
74
+ * },
75
+ * animation: {
76
+ * name: "fade",
77
+ * animate: "enter",
78
+ * duration: 2
79
+ * }
80
+ * }]
81
+ * }]
82
+ * });
83
+ * });
84
+ * ```
85
+ *
86
+ * ### 3. Advanced Features
87
+ * - **Multi-track scenes** with synchronized elements
88
+ * - **Complex animations** with enter/exit effects
89
+ * - **Text effects** like typewriter and streaming
90
+ * - **Frame effects** for visual masking
91
+ * - **Media integration** for video, audio, and images
92
+ *
93
+ * ## 📚 Core Concepts
94
+ *
95
+ * ### Elements
96
+ * Visual components that can be rendered in the scene:
97
+ * - **Media Elements**: Video, Image, Audio for content display
98
+ * - **Text Elements**: Text, Caption for information overlay
99
+ * - **Shape Elements**: Rect, Circle, Icon for UI components
100
+ * - **Container Elements**: Scene for organization
101
+ *
102
+ * ### Animations
103
+ * Motion effects that bring elements to life:
104
+ * - **Basic**: Fade, Rise for simple transitions
105
+ * - **Advanced**: Blur, Breathe, Succession for complex effects
106
+ * - **Photo-specific**: PhotoRise, PhotoZoom for media content
107
+ *
108
+ * ### Text Effects
109
+ * Character and word-level text animations:
110
+ * - **Typewriter**: Character-by-character reveal
111
+ * - **Stream Word**: Word-by-word animation
112
+ * - **Elastic**: Bounce-in effects
113
+ * - **Erase**: Backspace-style removal
114
+ *
115
+ * ### Frame Effects
116
+ * Visual masking and container transformations:
117
+ * - **Circle Frame**: Circular content masking
118
+ * - **Rect Frame**: Rectangular content masking
119
+ *
120
+ * ## 🎯 Use Cases
121
+ *
122
+ * - **Video Presentations**: Professional slideshows with animations
123
+ * - **Content Creation**: Social media videos with effects
124
+ * - **Educational Content**: Interactive learning materials
125
+ * - **Marketing Videos**: Branded content with visual effects
126
+ * - **Live Streaming**: Real-time visual enhancements
127
+ *
128
+ * ## 🔧 Integration
129
+ *
130
+ * The library integrates seamlessly with:
131
+ * - **@twick/2d**: 2D graphics and scene management
132
+ * - **@twick/core**: Animation and timing utilities
133
+ * - **@twick/timeline**: Timeline-based content management
134
+ * - **@twick/video-editor**: Video editing capabilities
135
+ *
136
+ * ## 📖 Documentation Structure
137
+ *
138
+ * This documentation is organized into logical categories:
139
+ * 1. **Core**: Main scene generator and core functionality
140
+ * 2. **Animations**: Motion effects and transitions
141
+ * 3. **Elements**: Visual components and content
142
+ * 4. **Text Effects**: Text animation and styling
143
+ * 5. **Frame Effects**: Visual masking and containers
144
+ * 6. **Types**: TypeScript type definitions
145
+ * 7. **Interfaces**: Component interfaces and contracts
146
+ *
147
+ * Each component includes:
148
+ * - Detailed description and use cases
149
+ * - Complete parameter documentation
150
+ * - Practical code examples
151
+ * - Integration patterns
152
+ * - Performance considerations
153
+ *
154
+ * ## 🚀 Performance Tips
155
+ *
156
+ * - **Use parallel animations** with `all()` for better performance
157
+ * - **Optimize timing** by setting precise start/end times
158
+ * - **Reuse elements** when possible to reduce memory usage
159
+ * - **Batch operations** for multiple similar elements
160
+ * - **Monitor resource usage** for large scenes
161
+ *
162
+ * ## 🔍 Troubleshooting
163
+ *
164
+ * **Common Issues:**
165
+ * - **Elements not appearing**: Check start/end timing values
166
+ * - **Animations not working**: Verify animation name and parameters
167
+ * - **Performance issues**: Use parallel execution and optimize timing
168
+ * - **Memory leaks**: Ensure proper cleanup of media resources
169
+ *
170
+ * **Debug Tips:**
171
+ * - Use browser dev tools to inspect scene structure
172
+ * - Check console logs for timing and error messages
173
+ * - Verify all required dependencies are installed
174
+ * - Test with simple examples before complex scenes
175
+ *
176
+ * @packageDocumentation
177
+ */
178
+
1
179
  // Types
2
180
  export * from './helpers/types';
3
181
 
4
182
  // Components
5
183
  export * from './visualizer';
6
184
 
185
+ /**
186
+ * @group Core
187
+ * @description Main scene generator and core functionality
188
+ */
189
+ export { scene } from './visualizer';
190
+
191
+ // Grouped exports for better organization
192
+ export * from './animations';
193
+ export * from './elements';
194
+ export * from './text-effects';
195
+ export * from './frame-effects';
196
+
@@ -2,23 +2,54 @@ import { easeOutElastic, waitFor } from "@twick/core";
2
2
  import { TextEffectParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * ElasticEffect applies a scaling animation to text elements
6
- * with an elastic easing curve for a "pop" or "bounce" effect.
5
+ * @group ElasticEffect
6
+ * ElasticEffect applies a scaling animation to text elements with an elastic easing
7
+ * curve for a "pop" or "bounce" effect. Creates playful, attention-grabbing text
8
+ * animations that bounce into view with natural physics.
7
9
  *
8
10
  * Behavior:
9
- * - Optionally waits for a delay.
10
- * - Starts at zero scale (invisible).
11
- * - Scales up to full size with an elastic bounce.
11
+ * - Optionally waits for a delay
12
+ * - Starts at zero scale (invisible)
13
+ * - Scales up to full size with an elastic bounce
12
14
  *
13
- * @param elementRef - Reference to the text element to animate.
14
- * @param duration - Duration of the scaling animation.
15
- * @param delay - Optional delay before the animation starts.
15
+ * @param elementRef - Reference to the text element to animate
16
+ * @param duration - Duration of the scaling animation in seconds
17
+ * @param delay - Optional delay before the animation starts in seconds
18
+ *
19
+ * @example
20
+ * ```js
21
+ * // Basic elastic bounce
22
+ * textEffect: {
23
+ * name: "elastic",
24
+ * duration: 1.5,
25
+ * delay: 0.5
26
+ * }
27
+ *
28
+ * // Quick elastic pop
29
+ * textEffect: {
30
+ * name: "elastic",
31
+ * duration: 0.8
32
+ * }
33
+ * ```
16
34
  */
17
35
  export const ElasticEffect = {
18
36
  name: "elastic",
19
37
 
20
38
  /**
21
39
  * Generator function controlling the elastic text scaling effect.
40
+ * Handles elastic bounce animations for text elements with natural physics.
41
+ *
42
+ * @param params - Text effect parameters including element reference and timing
43
+ * @returns Generator that controls the elastic animation timeline
44
+ *
45
+ * @example
46
+ * ```js
47
+ * yield* ElasticEffect.run({
48
+ * elementRef: textElement,
49
+ * duration: 1.5,
50
+ * delay: 0.5
51
+ * });
52
+ * ```
22
53
  */
23
54
  *run({
24
55
  elementRef,
@@ -2,24 +2,57 @@ import { waitFor } from "@twick/core";
2
2
  import { TextEffectParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * EraseEffect animates text disappearing letter by letter,
6
- * simulating an "erasing" or backspace effect.
5
+ * @group EraseEffect
6
+ * EraseEffect animates text disappearing letter by letter, simulating an "erasing"
7
+ * or backspace effect. Creates engaging text removal animations that mimic
8
+ * real-world erasing or typing corrections.
7
9
  *
8
10
  * Behavior:
9
- * - Optionally waits for a delay before starting.
10
- * - Preserves the original element size.
11
- * - Animates removing one character at a time from the end.
11
+ * - Optionally waits for a delay before starting
12
+ * - Preserves the original element size
13
+ * - Animates removing one character at a time from the end
12
14
  *
13
- * @param elementRef - Reference to the text element to animate.
14
- * @param duration - Total duration of the erasing animation.
15
- * @param delay - Optional delay before starting.
16
- * @param bufferTime - Time reserved at the end of animation (default: 0.1).
15
+ * @param elementRef - Reference to the text element to animate
16
+ * @param duration - Total duration of the erasing animation in seconds
17
+ * @param delay - Optional delay before starting in seconds
18
+ * @param bufferTime - Time reserved at the end of animation in seconds (default: 0.1)
19
+ *
20
+ * @example
21
+ * ```js
22
+ * // Basic erase effect
23
+ * textEffect: {
24
+ * name: "erase",
25
+ * duration: 3,
26
+ * delay: 1
27
+ * }
28
+ *
29
+ * // Quick erase with buffer time
30
+ * textEffect: {
31
+ * name: "erase",
32
+ * duration: 2,
33
+ * bufferTime: 0.5
34
+ * }
35
+ * ```
17
36
  */
18
37
  export const EraseEffect = {
19
38
  name: "erase",
20
39
 
21
40
  /**
22
41
  * Generator function controlling the erase text effect.
42
+ * Handles character-by-character text removal animations.
43
+ *
44
+ * @param params - Text effect parameters including element reference and timing
45
+ * @returns Generator that controls the erase animation timeline
46
+ *
47
+ * @example
48
+ * ```js
49
+ * yield* EraseEffect.run({
50
+ * elementRef: textElement,
51
+ * duration: 3,
52
+ * delay: 1,
53
+ * bufferTime: 0.1
54
+ * });
55
+ * ```
23
56
  */
24
57
  *run({
25
58
  elementRef,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @group Text Effects
3
+ * @description Text animation and styling effects
4
+ */
5
+
6
+ export { TypewriterEffect } from './typewriter';
7
+ export { StreamWordEffect } from './stream-word';
8
+ export { ElasticEffect } from './elastic';
9
+ export { EraseEffect } from './erase';
@@ -2,24 +2,58 @@ import { waitFor } from "@twick/core";
2
2
  import { TextEffectParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * StreamWordEffect animates text appearing word by word,
6
- * creating a smooth "typing" or "streaming" effect.
5
+ * @group StreamWordEffect
6
+ * StreamWordEffect animates text appearing word by word, creating a smooth
7
+ * "typing" or "streaming" effect. Animates text word by word for natural
8
+ * reading flow and storytelling content.
7
9
  *
8
10
  * Behavior:
9
- * - Optionally waits for a delay before starting.
10
- * - Clears the text initially and preserves the original size.
11
- * - Reveals one word at a time with a consistent interval.
11
+ * - Optionally waits for a delay before starting
12
+ * - Clears the text initially and preserves the original size
13
+ * - Reveals one word at a time with a consistent interval
12
14
  *
13
- * @param elementRef - Reference to the text element to animate.
14
- * @param duration - Total duration of the animation.
15
- * @param delay - Optional delay before starting.
16
- * @param bufferTime - Time reserved at the end of animation (default: 0.1).
15
+ * @param elementRef - Reference to the text element to animate
16
+ * @param duration - Total duration of the animation in seconds
17
+ * @param delay - Optional delay before starting in seconds
18
+ * @param bufferTime - Time reserved at the end of animation in seconds
19
+ *
20
+ * @example
21
+ * ```js
22
+ * // Basic stream word effect
23
+ * textEffect: {
24
+ * name: "stream-word",
25
+ * duration: 2,
26
+ * interval: 0.3
27
+ * }
28
+ *
29
+ * // With delay for dramatic effect
30
+ * textEffect: {
31
+ * name: "stream-word",
32
+ * duration: 4,
33
+ * delay: 1,
34
+ * bufferTime: 0.5
35
+ * }
36
+ * ```
17
37
  */
18
38
  export const StreamWordEffect = {
19
39
  name: "stream-word",
20
40
 
21
41
  /**
22
42
  * Generator function controlling the word streaming effect.
43
+ * Handles text clearing, word-by-word revelation, and timing for natural reading flow.
44
+ *
45
+ * @param params - Text effect parameters including element reference and timing
46
+ * @returns Generator that controls the stream word animation timeline
47
+ *
48
+ * @example
49
+ * ```js
50
+ * yield* StreamWordEffect.run({
51
+ * elementRef: textElement,
52
+ * duration: 2,
53
+ * delay: 0.5,
54
+ * bufferTime: 0.1
55
+ * });
56
+ * ```
23
57
  */
24
58
  *run({
25
59
  elementRef,
@@ -2,24 +2,58 @@ import { waitFor } from "@twick/core";
2
2
  import { TextEffectParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * TypewriterEffect animates text appearing one character at a time,
6
- * mimicking the behavior of a classic typewriter.
5
+ * @group TypewriterEffect
6
+ * TypewriterEffect animates text appearing one character at a time, mimicking the
7
+ * behavior of a classic typewriter. Creates a nostalgic, engaging text animation
8
+ * that draws attention to important content.
7
9
  *
8
10
  * Behavior:
9
- * - Optionally waits for a delay before starting.
10
- * - Clears the text initially and preserves the element's original size.
11
- * - Reveals one character at a time at a consistent interval.
11
+ * - Optionally waits for a delay before starting
12
+ * - Clears the text initially and preserves the element's original size
13
+ * - Reveals one character at a time at a consistent interval
12
14
  *
13
- * @param elementRef - Reference to the text element to animate.
14
- * @param duration - Total duration of the animation.
15
- * @param delay - Optional delay before starting.
16
- * @param bufferTime - Time reserved at the end of animation (default: 0.1).
15
+ * @param elementRef - Reference to the text element to animate
16
+ * @param duration - Total duration of the animation in seconds
17
+ * @param delay - Optional delay before starting in seconds
18
+ * @param bufferTime - Time reserved at the end of animation in seconds
19
+ *
20
+ * @example
21
+ * ```js
22
+ * // Basic typewriter effect
23
+ * textEffect: {
24
+ * name: "typewriter",
25
+ * duration: 3,
26
+ * interval: 0.1
27
+ * }
28
+ *
29
+ * // With delay and buffer time
30
+ * textEffect: {
31
+ * name: "typewriter",
32
+ * duration: 5,
33
+ * delay: 1,
34
+ * bufferTime: 0.5
35
+ * }
36
+ * ```
17
37
  */
18
38
  export const TypewriterEffect = {
19
39
  name: "typewriter",
20
40
 
21
41
  /**
22
42
  * Generator function controlling the character-by-character typing animation.
43
+ * Handles text clearing, character revelation, and timing for the typewriter effect.
44
+ *
45
+ * @param params - Text effect parameters including element reference and timing
46
+ * @returns Generator that controls the typewriter animation timeline
47
+ *
48
+ * @example
49
+ * ```js
50
+ * yield* TypewriterEffect.run({
51
+ * elementRef: textElement,
52
+ * duration: 3,
53
+ * delay: 0.5,
54
+ * bufferTime: 0.1
55
+ * });
56
+ * ```
23
57
  */
24
58
  *run({
25
59
  elementRef,
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @twick/visualizer - Professional Video Visualization Library
3
+ *
4
+ * A comprehensive TypeScript library for creating dynamic video visualizations with
5
+ * animations, effects, and interactive elements. Built on top of @twick/2d and @twick/core
6
+ * for high-performance 2D graphics and animation.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+
11
+ // Types
12
+ export * from './helpers/types';
13
+
14
+ // Core functionality
15
+ export * from './visualizer';
16
+
17
+ /**
18
+ * @group Core
19
+ * @description Main scene generator and core functionality
20
+ */
21
+ export { scene } from './visualizer';
22
+
23
+ /**
24
+ * @group Animations
25
+ * @description Motion effects and transitions for elements
26
+ */
27
+
28
+ // Basic animations
29
+ export { FadeAnimation } from './animations/fade';
30
+ export { RiseAnimation } from './animations/rise';
31
+
32
+ // Advanced animations
33
+ export { BlurAnimation } from './animations/blur';
34
+ export { BreatheAnimation } from './animations/breathe';
35
+ export { SuccessionAnimation } from './animations/succession';
36
+
37
+ // Photo-specific animations
38
+ export { PhotoRiseAnimation } from './animations/photo-rise';
39
+ export { PhotoZoomAnimation } from './animations/photo-zoom';
40
+
41
+ /**
42
+ * @group Elements
43
+ * @description Visual components for creating scenes and content
44
+ */
45
+
46
+ // Media elements
47
+ export { VideoElement } from './elements/video.element';
48
+ export { ImageElement } from './elements/image.element';
49
+ export { AudioElement } from './elements/audio.element';
50
+
51
+ // Text and caption elements
52
+ export { TextElement } from './elements/text.element';
53
+ export { CaptionElement } from './elements/caption.element';
54
+
55
+ // Shape and UI elements
56
+ export { RectElement } from './elements/rect.element';
57
+ export { CircleElement } from './elements/circle.element';
58
+ export { IconElement } from './elements/icon.element';
59
+
60
+ // Special elements
61
+ export { SceneElement } from './elements/scene.element';
62
+
63
+ /**
64
+ * @group Text Effects
65
+ * @description Text animation and styling effects
66
+ */
67
+
68
+ // Basic text effects
69
+ export { TypewriterEffect } from './text-effects/typewriter';
70
+ export { StreamWordEffect } from './text-effects/stream-word';
71
+
72
+ // Advanced text effects
73
+ export { ElasticEffect } from './text-effects/elastic';
74
+ export { EraseEffect } from './text-effects/erase';
75
+
76
+ /**
77
+ * @group Frame Effects
78
+ * @description Visual frame and masking effects
79
+ */
80
+
81
+ // Frame effects
82
+ export { CircleFrameEffect } from './frame-effects/circle.frame';
83
+ export { RectFrameEffect } from './frame-effects/rect.frame';
@@ -1,6 +1,43 @@
1
1
  /**
2
+ * @twick/visualizer - Professional Video Visualization Library
3
+ *
2
4
  * Main visualizer component that renders the scene with video, audio, captions and other elements
3
- * based on the provided input configuration.
5
+ * based on the provided input configuration. Creates a complete visualization scene with
6
+ * background, tracks, animations, and effects for professional video content.
7
+ *
8
+ * ## Scene Architecture
9
+ *
10
+ * The visualizer creates a hierarchical scene structure:
11
+ * ```
12
+ * Scene
13
+ * ├── Background Container
14
+ * ├── Track 1
15
+ * │ ├── Element 1 (Video/Image/Audio)
16
+ * │ ├── Element 2 (Text/Caption)
17
+ * │ └── Element 3 (Shapes/UI)
18
+ * ├── Track 2
19
+ * │ └── ...
20
+ * └── Track N
21
+ * ```
22
+ *
23
+ * ## Core Features
24
+ *
25
+ * - **Multi-Track Support**: Organize elements into logical tracks
26
+ * - **Animation System**: Rich animation library with enter/exit effects
27
+ * - **Text Effects**: Character and word-level text animations
28
+ * - **Frame Effects**: Visual masking and container transformations
29
+ * - **Media Support**: Video, image, and audio content management
30
+ * - **Timing Control**: Precise start/end timing for all elements
31
+ *
32
+ * ## Use Cases
33
+ *
34
+ * - **Video Presentations**: Professional slideshows with animations
35
+ * - **Content Creation**: Social media videos with effects
36
+ * - **Educational Content**: Interactive learning materials
37
+ * - **Marketing Videos**: Branded content with visual effects
38
+ * - **Live Streaming**: Real-time visual enhancements
39
+ *
40
+ * @packageDocumentation
4
41
  */
5
42
 
6
43
  import "./global.css";
@@ -24,10 +61,57 @@ import {
24
61
  import { dispatchWindowEvent } from "./helpers/event.utils";
25
62
 
26
63
  /**
27
- * Creates and configures the main scene for video visualization
28
- * @param {string} name - Name of the scene
29
- * @param {Function} generator - Generator function that handles scene setup and animation
30
- * @returns {Scene2D} Configured scene object
64
+ * @category Core
65
+ * @description Main scene generator for video visualization
66
+ *
67
+ * Creates and configures the main scene for video visualization. Sets up a scene with
68
+ * background, processes track elements, and handles animation generation for video,
69
+ * audio, captions, and other visual elements.
70
+ *
71
+ * ## Scene Lifecycle
72
+ *
73
+ * 1. **Input Processing**: Retrieves video input configuration from scene variables
74
+ * 2. **Background Setup**: Creates background rectangle with specified color
75
+ * 3. **Track Processing**: Iterates through tracks and creates appropriate visualizations
76
+ * 4. **Animation Execution**: Runs all track animations in parallel using `all()`
77
+ * 5. **Event Dispatch**: Sends player update events for status tracking
78
+ *
79
+ * ## Track Types Supported
80
+ *
81
+ * - **VIDEO**: Video content with playback and effects
82
+ * - **AUDIO**: Audio content with timing and synchronization
83
+ * - **CAPTION**: Text overlays with styling and animations
84
+ * - **SCENE**: Scene containers for organization
85
+ * - **ELEMENT**: Custom elements with animations
86
+ *
87
+ * ## 📊 Performance Features
88
+ *
89
+ * - **Parallel Execution**: All track animations run concurrently
90
+ * - **Event-Driven**: Real-time status updates via window events
91
+ * - **Resource Management**: Automatic cleanup and memory optimization
92
+ * - **Error Handling**: Graceful fallbacks for missing configurations
93
+ *
94
+ * @param name - Name of the scene for identification
95
+ * @param generator - Generator function that handles scene setup and animation
96
+ * @returns Configured scene object with all track animations
97
+ *
98
+ * @example
99
+ * ```js
100
+ * // Basic scene setup
101
+ * const scene = makeScene2D("scene", function* (view) {
102
+ * // Scene setup and animation logic
103
+ * yield* all(...trackAnimations);
104
+ * });
105
+ *
106
+ * // With video input configuration
107
+ * const videoScene = makeScene2D("video-scene", function* (view) {
108
+ * // Configure scene variables
109
+ * useScene().variables.set("input", videoInput);
110
+ * useScene().variables.set("playerId", "main-player");
111
+ *
112
+ * // Scene will automatically process the input
113
+ * });
114
+ * ```
31
115
  */
32
116
  export const scene = makeScene2D("scene", function* (view: View2D) {
33
117
  // Get input configuration from scene variables
package/typedoc.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["./src/index.ts"],
3
+ "entryPoints": ["./src/visualizer-grouped.ts"],
4
4
  "out": "docs",
5
5
  "name": "@twick/visualizer",
6
6
  "excludePrivate": true,
@@ -10,6 +10,11 @@
10
10
  "readme": "README.md",
11
11
  "plugin": ["typedoc-plugin-markdown"],
12
12
  "categorizeByGroup": true,
13
- "categoryOrder": ["Core", "Utils", "*"],
14
- "hideBreadcrumbs": true
13
+ "categoryOrder": ["Core", "FadeAnimation", "RiseAnimation", "BlurAnimation", "BreatheAnimation", "SuccessionAnimation", "PhotoRiseAnimation", "PhotoZoomAnimation", "VideoElement", "ImageElement", "AudioElement", "TextElement", "CaptionElement", "RectElement", "CircleElement", "IconElement", "SceneElement", "TypewriterEffect", "StreamWordEffect", "ElasticEffect", "EraseEffect", "CircleFrameEffect", "RectFrameEffect", "Types", "Interfaces", "Other"],
14
+ "hideBreadcrumbs": true,
15
+ "groupOrder": ["Core", "FadeAnimation", "RiseAnimation", "BlurAnimation", "BreatheAnimation", "SuccessionAnimation", "PhotoRiseAnimation", "PhotoZoomAnimation", "VideoElement", "ImageElement", "AudioElement", "TextElement", "CaptionElement", "RectElement", "CircleElement", "IconElement", "SceneElement", "TypewriterEffect", "StreamWordEffect", "ElasticEffect", "EraseEffect", "CircleFrameEffect", "RectFrameEffect", "Types", "Interfaces", "Other"],
16
+ "sort": ["source-order"],
17
+ "defaultCategory": "Other",
18
+ "hideInPageTOC": false,
19
+ "includeVersion": true
15
20
  }