@twick/visualizer 0.14.0 → 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 (68) hide show
  1. package/.eslintrc.json +20 -20
  2. package/README.md +113 -13
  3. package/package.json +14 -14
  4. package/package.json.bak +34 -0
  5. package/src/animations/blur.tsx +96 -60
  6. package/src/animations/breathe.tsx +95 -60
  7. package/src/animations/fade.tsx +173 -60
  8. package/src/animations/index.ts +12 -0
  9. package/src/animations/photo-rise.tsx +103 -66
  10. package/src/animations/photo-zoom.tsx +109 -73
  11. package/src/animations/rise.tsx +157 -118
  12. package/src/animations/succession.tsx +112 -77
  13. package/src/components/frame-effects.tsx +188 -188
  14. package/src/components/track.tsx +237 -232
  15. package/src/controllers/animation.controller.ts +38 -38
  16. package/src/controllers/element.controller.ts +42 -42
  17. package/src/controllers/frame-effect.controller.tsx +29 -29
  18. package/src/controllers/text-effect.controller.ts +32 -32
  19. package/src/elements/audio.element.tsx +79 -17
  20. package/src/elements/caption.element.tsx +169 -87
  21. package/src/elements/circle.element.tsx +88 -20
  22. package/src/elements/icon.element.tsx +88 -20
  23. package/src/elements/image.element.tsx +134 -55
  24. package/src/elements/index.ts +14 -0
  25. package/src/elements/rect.element.tsx +92 -22
  26. package/src/elements/scene.element.tsx +97 -29
  27. package/src/elements/text.element.tsx +101 -27
  28. package/src/elements/video.element.tsx +274 -56
  29. package/src/frame-effects/circle.frame.tsx +168 -103
  30. package/src/frame-effects/index.ts +7 -0
  31. package/src/frame-effects/rect.frame.tsx +198 -103
  32. package/src/global.css +11 -11
  33. package/src/helpers/caption.utils.ts +29 -29
  34. package/src/helpers/constants.ts +162 -158
  35. package/src/helpers/element.utils.ts +331 -239
  36. package/src/helpers/event.utils.ts +21 -0
  37. package/src/helpers/filters.ts +127 -127
  38. package/src/helpers/log.utils.ts +55 -29
  39. package/src/helpers/timing.utils.ts +109 -109
  40. package/src/helpers/types.ts +361 -241
  41. package/src/helpers/utils.ts +36 -19
  42. package/src/index.ts +196 -6
  43. package/src/live.tsx +16 -16
  44. package/src/project.ts +6 -6
  45. package/src/sample.ts +247 -247
  46. package/src/text-effects/elastic.tsx +70 -39
  47. package/src/text-effects/erase.tsx +91 -58
  48. package/src/text-effects/index.ts +9 -0
  49. package/src/text-effects/stream-word.tsx +94 -60
  50. package/src/text-effects/typewriter.tsx +93 -59
  51. package/src/visualizer-grouped.ts +83 -0
  52. package/src/visualizer.tsx +182 -78
  53. package/tsconfig.json +11 -11
  54. package/typedoc.json +19 -14
  55. package/vite.config.ts +15 -15
  56. package/.turbo/turbo-build.log +0 -19
  57. package/.turbo/turbo-docs.log +0 -7
  58. package/LICENSE +0 -197
  59. package/dist/mp4.wasm +0 -0
  60. package/dist/project.css +0 -1
  61. package/dist/project.js +0 -145
  62. package/docs/.nojekyll +0 -1
  63. package/docs/README.md +0 -13
  64. package/docs/interfaces/Animation.md +0 -47
  65. package/docs/interfaces/Element.md +0 -47
  66. package/docs/interfaces/FrameEffectPlugin.md +0 -47
  67. package/docs/interfaces/TextEffect.md +0 -47
  68. package/docs/modules.md +0 -535
package/src/index.ts CHANGED
@@ -1,6 +1,196 @@
1
- // Types
2
- export * from './helpers/types';
3
-
4
- // Components
5
- export * from './visualizer';
6
-
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
+
179
+ // Types
180
+ export * from './helpers/types';
181
+
182
+ // Components
183
+ export * from './visualizer';
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
+
package/src/live.tsx CHANGED
@@ -1,16 +1,16 @@
1
- import { makeProject } from "@twick/core";
2
- import { scene } from "./visualizer";
3
- import { sample } from "./sample";
4
-
5
- export default makeProject({
6
- scenes: [scene],
7
- variables: sample,
8
- settings: {
9
- shared: {
10
- size: {
11
- x: sample.input.properties.width,
12
- y: sample.input.properties.height,
13
- },
14
- },
15
- },
16
- });
1
+ import { makeProject } from "@twick/core";
2
+ import { scene } from "./visualizer";
3
+ import { sample } from "./sample";
4
+
5
+ export default makeProject({
6
+ scenes: [scene],
7
+ variables: sample,
8
+ settings: {
9
+ shared: {
10
+ size: {
11
+ x: sample.input.properties.width,
12
+ y: sample.input.properties.height,
13
+ },
14
+ },
15
+ },
16
+ });
package/src/project.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { makeProject } from "@twick/core";
2
- import { scene } from "./visualizer";
3
-
4
- export default makeProject({
5
- scenes: [scene],
6
- });
1
+ import { makeProject } from "@twick/core";
2
+ import { scene } from "./visualizer";
3
+
4
+ export default makeProject({
5
+ scenes: [scene],
6
+ });