@twick/visualizer 0.14.2 → 0.14.4

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/README.md CHANGED
@@ -1,13 +1,113 @@
1
1
  # @twick/visualizer
2
2
 
3
- A visualization library built on top of [@twick/2d](https://github.com/re-video/2d) for creating interactive visualizations.
3
+ A visualization library built on top of [@twick/2d](https://github.com/re-video/2d) for creating interactive visualizations and animations.
4
+
5
+ ## Overview
6
+
7
+ This package provides advanced visualization capabilities for creating interactive animations, effects, and visual elements in video editing applications. Built on top of a 2D graphics engine, it offers powerful tools for creating professional visual content.
4
8
 
5
9
  ## Installation
10
+
11
+ ```bash
12
+ npm install @twick/visualizer
13
+ # or
14
+ pnpm add @twick/visualizer
6
15
  ```
7
- pnpm install
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import {
21
+ createVisualization,
22
+ addAnimation,
23
+ renderScene
24
+ } from '@twick/visualizer';
25
+
26
+ // Create a new visualization
27
+ const viz = createVisualization({
28
+ width: 1920,
29
+ height: 1080,
30
+ duration: 10
31
+ });
32
+
33
+ // Add animations and effects
34
+ addAnimation(viz, {
35
+ type: 'fade',
36
+ startTime: 0,
37
+ duration: 2
38
+ });
39
+
40
+ // Render the scene
41
+ const output = await renderScene(viz);
8
42
  ```
9
43
 
10
- ## Build
44
+ ## Key Features
45
+
46
+ - **Interactive Visualizations**: Create dynamic visual content
47
+ - **Animation Engine**: Powerful animation system with keyframes
48
+ - **Effect Library**: Built-in effects and transitions
49
+ - **Performance Optimized**: Efficient rendering for real-time applications
50
+ - **Extensible**: Plugin system for custom effects
51
+ - **2D Graphics**: Full 2D graphics capabilities
52
+
53
+ ## Development
54
+
55
+ ### Installation
56
+
57
+ ```bash
58
+ pnpm install
11
59
  ```
60
+
61
+ ### Build
62
+
63
+ ```bash
12
64
  pnpm build
13
- ```
65
+ ```
66
+
67
+ ### Development Server
68
+
69
+ ```bash
70
+ pnpm dev
71
+ ```
72
+
73
+ ## API Reference
74
+
75
+ ### Core Functions
76
+
77
+ - `createVisualization`: Create a new visualization instance
78
+ - `addAnimation`: Add animations to the scene
79
+ - `renderScene`: Render the visualization to output
80
+ - `addEffect`: Apply visual effects
81
+ - `exportAnimation`: Export animations in various formats
82
+
83
+ ### Types
84
+
85
+ - `VisualizationConfig`: Configuration for visualizations
86
+ - `AnimationOptions`: Animation configuration options
87
+ - `EffectConfig`: Effect configuration interface
88
+ - `RenderOptions`: Rendering options
89
+
90
+ For complete API documentation, refer to the generated documentation.
91
+
92
+ ## Browser Support
93
+
94
+ This package requires a browser environment with support for:
95
+ - WebGL or Canvas 2D
96
+ - Modern JavaScript features (ES2020+)
97
+ - RequestAnimationFrame API
98
+
99
+ ## Documentation
100
+
101
+ For complete documentation, refer to the project documentation site.
102
+
103
+ ## License
104
+
105
+ This package is licensed under the **Sustainable Use License (SUL) Version 1.0**.
106
+
107
+ - Free for use in commercial and non-commercial apps
108
+ - Can be modified and self-hosted
109
+ - Cannot be sold, rebranded, or distributed as a standalone SDK
110
+
111
+ For commercial licensing inquiries, contact: contact@kifferai.com
112
+
113
+ For full license terms, see the main LICENSE.md file in the project root.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@twick/visualizer",
3
- "version": "0.14.2",
4
- "license": "Apache-2.0",
3
+ "version": "0.14.4",
4
+ "license": "SEE LICENSE IN LICENSE.md",
5
5
  "scripts": {
6
6
  "start": "twick editor --projectFile ./src/live.tsx",
7
7
  "build": "tsc && vite build",
8
- "docs": "typedoc --out docs src/index.ts",
8
+ "docs": "typedoc --out docs src/visualizer-grouped.ts",
9
9
  "clean": "rimraf .turbo node_modules dist"
10
10
  },
11
11
  "publishConfig": {
@@ -13,14 +13,14 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@preact/signals": "^1.2.1",
16
- "@twick/2d": "0.14.2",
17
- "@twick/core": "0.14.2",
18
- "@twick/renderer": "0.14.2",
19
- "@twick/vite-plugin": "0.14.2",
16
+ "@twick/2d": "0.14.4",
17
+ "@twick/core": "0.14.4",
18
+ "@twick/renderer": "0.14.4",
19
+ "@twick/vite-plugin": "0.14.4",
20
20
  "date-fns": "^4.1.0",
21
21
  "preact": "^10.19.2",
22
22
  "crelt": "^1.0.6",
23
- "@twick/media-utils": "0.14.2"
23
+ "@twick/media-utils": "0.14.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@twick/cli": "0.14.0",
package/package.json.bak CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@twick/visualizer",
3
- "version": "0.14.2",
4
- "license": "Apache-2.0",
3
+ "version": "0.14.4",
4
+ "license": "SEE LICENSE IN LICENSE.md",
5
5
  "scripts": {
6
6
  "start": "twick editor --projectFile ./src/live.tsx",
7
7
  "build": "tsc && vite build",
8
- "docs": "typedoc --out docs src/index.ts",
8
+ "docs": "typedoc --out docs src/visualizer-grouped.ts",
9
9
  "clean": "rimraf .turbo node_modules dist"
10
10
  },
11
11
  "publishConfig": {
@@ -13,14 +13,14 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@preact/signals": "^1.2.1",
16
- "@twick/2d": "0.14.2",
17
- "@twick/core": "0.14.2",
18
- "@twick/renderer": "0.14.2",
19
- "@twick/vite-plugin": "0.14.2",
16
+ "@twick/2d": "0.14.4",
17
+ "@twick/core": "0.14.4",
18
+ "@twick/renderer": "0.14.4",
19
+ "@twick/vite-plugin": "0.14.4",
20
20
  "date-fns": "^4.1.0",
21
21
  "preact": "^10.19.2",
22
22
  "crelt": "^1.0.6",
23
- "@twick/media-utils": "0.14.2"
23
+ "@twick/media-utils": "0.14.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@twick/cli": "0.14.0",
@@ -2,26 +2,62 @@ import { waitFor } from "@twick/core";
2
2
  import { AnimationParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * BlurAnimation applies a blur effect to an element or its container
6
- * during enter, exit, or both animations.
5
+ * @group BlurAnimation
6
+ * BlurAnimation applies a blur effect to an element or its container during enter,
7
+ * exit, or both animations. Creates smooth blur transitions for professional
8
+ * visual effects that can focus attention or create depth.
7
9
  *
8
10
  * Available animation modes:
9
- * - "enter": Starts blurred and gradually becomes clear.
10
- * - "exit": Starts clear and gradually becomes blurred.
11
- * - "both": Blurs in, clears, then blurs out.
11
+ * - "enter": Starts blurred and gradually becomes clear
12
+ * - "exit": Starts clear and gradually becomes blurred
13
+ * - "both": Blurs in, clears, then blurs out
12
14
  *
13
- * @param elementRef - Reference to the main element.
14
- * @param containerRef - Optional reference to a container element.
15
- * @param interval - Duration (in frames or ms) of each blur transition.
16
- * @param duration - Total duration of the animation.
17
- * @param intensity - Maximum blur strength (default: 25).
18
- * @param animate - Animation phase ("enter" | "exit" | "both").
15
+ * @param elementRef - Reference to the main element to animate
16
+ * @param containerRef - Optional reference to a container element
17
+ * @param interval - Duration of blur transitions in seconds
18
+ * @param duration - Total duration of the animation in seconds
19
+ * @param intensity - Maximum blur strength (default: 25)
20
+ * @param animate - Animation phase ("enter" | "exit" | "both")
21
+ *
22
+ * @example
23
+ * ```js
24
+ * // Basic blur-in animation
25
+ * animation: {
26
+ * name: "blur",
27
+ * animate: "enter",
28
+ * duration: 2,
29
+ * intensity: 15
30
+ * }
31
+ *
32
+ * // Blur out effect
33
+ * animation: {
34
+ * name: "blur",
35
+ * animate: "exit",
36
+ * duration: 1.5,
37
+ * intensity: 30
38
+ * }
39
+ * ```
19
40
  */
20
41
  export const BlurAnimation = {
21
42
  name: "blur",
22
43
 
23
44
  /**
24
45
  * Generator function controlling the blur animation.
46
+ * Handles blur transitions based on the specified animation mode and intensity.
47
+ *
48
+ * @param params - Animation parameters including element references and timing
49
+ * @returns Generator that controls the blur animation timeline
50
+ *
51
+ * @example
52
+ * ```js
53
+ * yield* BlurAnimation.run({
54
+ * elementRef: myElement,
55
+ * interval: 0.5,
56
+ * duration: 2,
57
+ * intensity: 25,
58
+ * animate: "enter"
59
+ * });
60
+ * ```
25
61
  */
26
62
  *run({
27
63
  elementRef,
@@ -3,24 +3,59 @@ import { AnimationParams } from "../helpers/types";
3
3
  import { getTimingFunction } from "../helpers/timing.utils";
4
4
 
5
5
  /**
6
- * BreatheAnimation applies a smooth scale in/out effect to simulate
7
- * a "breathing" motion.
6
+ * @group BreatheAnimation
7
+ * BreatheAnimation applies a smooth scale in/out effect to simulate a "breathing" motion.
8
+ * Creates gentle pulsing animations that add life and movement to static elements.
9
+ * Perfect for subtle background animations and attention-grabbing effects.
8
10
  *
9
11
  * Available modes:
10
- * - "in": Gradually scales down (shrinks) to the target intensity.
11
- * - "out": Starts scaled down, then grows back to original size.
12
+ * - "in": Gradually scales down (shrinks) to the target intensity
13
+ * - "out": Starts scaled down, then grows back to original size
12
14
  *
13
- * @param elementRef - Reference to the main element to animate.
14
- * @param containerRef - Optional reference to a container element.
15
- * @param mode - Animation phase ("in" | "out").
16
- * @param duration - Duration of the scaling animation.
17
- * @param intensity - Target scale factor (default: 0.5).
15
+ * @param elementRef - Reference to the main element to animate
16
+ * @param containerRef - Optional reference to a container element
17
+ * @param mode - Animation phase ("in" | "out")
18
+ * @param duration - Duration of the scaling animation in seconds
19
+ * @param intensity - Target scale factor (default: 0.5)
20
+ *
21
+ * @example
22
+ * ```js
23
+ * // Gentle breathing in effect
24
+ * animation: {
25
+ * name: "breathe",
26
+ * mode: "in",
27
+ * duration: 2,
28
+ * intensity: 0.8
29
+ * }
30
+ *
31
+ * // Breathing out animation
32
+ * animation: {
33
+ * name: "breathe",
34
+ * mode: "out",
35
+ * duration: 1.5,
36
+ * intensity: 0.6
37
+ * }
38
+ * ```
18
39
  */
19
40
  export const BreatheAnimation = {
20
41
  name: "breathe",
21
42
 
22
43
  /**
23
44
  * Generator function controlling the breathing scale animation.
45
+ * Handles smooth scaling transitions to create natural breathing motion.
46
+ *
47
+ * @param params - Animation parameters including element references and timing
48
+ * @returns Generator that controls the breathing animation timeline
49
+ *
50
+ * @example
51
+ * ```js
52
+ * yield* BreatheAnimation.run({
53
+ * elementRef: myElement,
54
+ * mode: "in",
55
+ * duration: 2,
56
+ * intensity: 0.8
57
+ * });
58
+ * ```
24
59
  */
25
60
  *run({
26
61
  elementRef,
@@ -2,25 +2,138 @@ import { waitFor } from "@twick/core";
2
2
  import { AnimationParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * FadeAnimation applies a simple fade-in and fade-out effect
6
- * by adjusting opacity.
7
- *
8
- * Available animation modes:
9
- * - "enter": Starts transparent and fades in to fully opaque.
10
- * - "exit": Waits, then fades out to transparent.
11
- * - "both": Fades in, waits, then fades out.
12
- *
13
- * @param elementRef - Reference to the main element to animate.
14
- * @param containerRef - Optional reference to a container element.
15
- * @param interval - Duration of the fade transition (in frames or ms).
16
- * @param duration - Total duration of the animation.
17
- * @param animate - Animation phase ("enter" | "exit" | "both").
5
+ * @group FadeAnimation
6
+ * @description Simple fade-in and fade-out effects for smooth element transitions
7
+ *
8
+ * FadeAnimation applies a simple fade-in and fade-out effect by adjusting opacity.
9
+ * Creates smooth opacity transitions for elements entering or exiting the scene.
10
+ * Perfect for subtle, professional animations that don't distract from content.
11
+ *
12
+ * ## Animation Modes
13
+ *
14
+ * - **"enter"**: Starts transparent and fades in to fully opaque
15
+ * - **"exit"**: Waits, then fades out to transparent
16
+ * - **"both"**: Fades in, waits, then fades out
17
+ *
18
+ * ## Use Cases
19
+ *
20
+ * - **Text overlays**: Smooth introduction of captions and titles
21
+ * - **Background elements**: Subtle scene transitions
22
+ * - **UI components**: Professional interface animations
23
+ * - **Content reveals**: Gentle disclosure of information
24
+ *
25
+ * ## Best Practices
26
+ *
27
+ * - **Duration**: 1-3 seconds for most use cases
28
+ * - **Timing**: Use "enter" for introductions, "exit" for conclusions
29
+ * - **Combination**: Pair with other animations for complex effects
30
+ * - **Performance**: Lightweight and efficient for multiple elements
31
+ *
32
+ * ## Integration Examples
33
+ *
34
+ * ### Basic Text Fade
35
+ * ```js
36
+ * {
37
+ * id: "welcome-text",
38
+ * type: "text",
39
+ * s: 0, e: 5,
40
+ * t: "Welcome!",
41
+ * animation: {
42
+ * name: "fade",
43
+ * animate: "enter",
44
+ * duration: 2
45
+ * }
46
+ * }
47
+ * ```
48
+ *
49
+ * ### Video with Fade Transition
50
+ * ```js
51
+ * {
52
+ * id: "intro-video",
53
+ * type: "video",
54
+ * s: 0, e: 10,
55
+ * props: { src: "intro.mp4" },
56
+ * animation: {
57
+ * name: "fade",
58
+ * animate: "both",
59
+ * duration: 3,
60
+ * interval: 1
61
+ * }
62
+ * }
63
+ * ```
64
+ *
65
+ * ### Multi-Element Fade Sequence
66
+ * ```js
67
+ * // Fade in multiple elements with staggered timing
68
+ * const elements = [
69
+ * {
70
+ * id: "title",
71
+ * type: "text",
72
+ * s: 0, e: 8,
73
+ * t: "Main Title",
74
+ * animation: { name: "fade", animate: "enter", duration: 2 }
75
+ * },
76
+ * {
77
+ * id: "subtitle",
78
+ * type: "text",
79
+ * s: 1, e: 8,
80
+ * t: "Subtitle",
81
+ * animation: { name: "fade", animate: "enter", duration: 2 }
82
+ * },
83
+ * {
84
+ * id: "background",
85
+ * type: "rect",
86
+ * s: 0, e: 10,
87
+ * props: { fill: "#000000", opacity: 0.5 },
88
+ * animation: { name: "fade", animate: "enter", duration: 1.5 }
89
+ * }
90
+ * ];
91
+ * ```
92
+ *
93
+ * @param elementRef - Reference to the main element to animate
94
+ * @param containerRef - Optional reference to a container element
95
+ * @param duration - Duration of the fade transition in seconds
96
+ * @param totalDuration - Total duration of the animation in seconds
97
+ * @param animate - Animation phase ("enter" | "exit" | "both")
98
+ *
99
+ * @example
100
+ * ```js
101
+ * // Basic fade-in animation
102
+ * animation: {
103
+ * name: "fade",
104
+ * animate: "enter",
105
+ * duration: 2,
106
+ * direction: "center"
107
+ * }
108
+ *
109
+ * // Fade in and out
110
+ * animation: {
111
+ * name: "fade",
112
+ * animate: "both",
113
+ * duration: 3,
114
+ * interval: 1
115
+ * }
116
+ * ```
18
117
  */
19
118
  export const FadeAnimation = {
20
119
  name: "fade",
21
120
 
22
121
  /**
23
122
  * Generator function controlling the fade animation.
123
+ * Handles opacity transitions based on the specified animation mode.
124
+ *
125
+ * @param params - Animation parameters including element references and timing
126
+ * @returns Generator that controls the fade animation timeline
127
+ *
128
+ * @example
129
+ * ```js
130
+ * yield* FadeAnimation.run({
131
+ * elementRef: myElement,
132
+ * interval: 1,
133
+ * duration: 3,
134
+ * animate: "enter"
135
+ * });
136
+ * ```
24
137
  */
25
138
  *run({
26
139
  elementRef,
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @group Animations
3
+ * @description Motion effects and transitions for elements
4
+ */
5
+
6
+ export { FadeAnimation } from './fade';
7
+ export { RiseAnimation } from './rise';
8
+ export { BlurAnimation } from './blur';
9
+ export { BreatheAnimation } from './breathe';
10
+ export { SuccessionAnimation } from './succession';
11
+ export { PhotoRiseAnimation } from './photo-rise';
12
+ export { PhotoZoomAnimation } from './photo-zoom';
@@ -1,29 +1,66 @@
1
1
  import { AnimationParams } from "../helpers/types";
2
2
 
3
3
  /**
4
+ * @group PhotoRiseAnimation
4
5
  * PhotoRiseAnimation applies a smooth directional movement to a photo element.
6
+ * Creates elegant slide-in animations that bring photos into view from any direction.
7
+ * Perfect for photo galleries, presentations, and content reveals.
5
8
  *
6
9
  * Behavior:
7
- * - Starts offset in a given direction (up, down, left, or right).
8
- * - Animates back to the original position over the specified duration.
10
+ * - Starts offset in a given direction (up, down, left, or right)
11
+ * - Animates back to the original position over the specified duration
9
12
  *
10
13
  * Available directions:
11
- * - "up": Starts below and moves upward.
12
- * - "down": Starts above and moves downward.
13
- * - "left": Starts to the right and moves leftward.
14
- * - "right": Starts to the left and moves rightward.
14
+ * - "up": Starts below and moves upward
15
+ * - "down": Starts above and moves downward
16
+ * - "left": Starts to the right and moves leftward
17
+ * - "right": Starts to the left and moves rightward
15
18
  *
16
- * @param elementRef - Reference to the photo element to animate.
17
- * @param containerRef - Optional reference to a container element (required for this animation).
18
- * @param direction - Direction of the movement ("up" | "down" | "left" | "right").
19
- * @param duration - Duration of the movement animation.
20
- * @param intensity - Offset distance in pixels (default: 200).
19
+ * @param elementRef - Reference to the photo element to animate
20
+ * @param containerRef - Optional reference to a container element (required for this animation)
21
+ * @param direction - Direction of the movement ("up" | "down" | "left" | "right")
22
+ * @param duration - Duration of the movement animation in seconds
23
+ * @param intensity - Offset distance in pixels (default: 200)
24
+ *
25
+ * @example
26
+ * ```js
27
+ * // Slide in from bottom
28
+ * animation: {
29
+ * name: "photo-rise",
30
+ * direction: "up",
31
+ * duration: 1.5,
32
+ * intensity: 300
33
+ * }
34
+ *
35
+ * // Slide in from left
36
+ * animation: {
37
+ * name: "photo-rise",
38
+ * direction: "left",
39
+ * duration: 2,
40
+ * intensity: 400
41
+ * }
42
+ * ```
21
43
  */
22
44
  export const PhotoRiseAnimation = {
23
45
  name: "photo-rise",
24
46
 
25
47
  /**
26
48
  * Generator function controlling the photo rise animation.
49
+ * Handles directional movement animations for photo elements.
50
+ *
51
+ * @param params - Animation parameters including element references and direction
52
+ * @returns Generator that controls the photo rise animation timeline
53
+ *
54
+ * @example
55
+ * ```js
56
+ * yield* PhotoRiseAnimation.run({
57
+ * elementRef: photoElement,
58
+ * containerRef: container,
59
+ * direction: "up",
60
+ * duration: 1.5,
61
+ * intensity: 200
62
+ * });
63
+ * ```
27
64
  */
28
65
  *run({
29
66
  elementRef,
@@ -2,24 +2,60 @@ import { Vector2 } from "@twick/core";
2
2
  import { AnimationParams } from "../helpers/types";
3
3
 
4
4
  /**
5
- * PhotoZoomAnimation applies a smooth zoom-in or zoom-out effect
6
- * on a photo element.
5
+ * @group PhotoZoomAnimation
6
+ * PhotoZoomAnimation applies a smooth zoom-in or zoom-out effect on a photo element.
7
+ * Creates dynamic zoom effects that add depth and focus to photo content.
8
+ * Perfect for highlighting details or creating cinematic photo presentations.
7
9
  *
8
10
  * Available animation modes:
9
- * - "in": Starts zoomed in and smoothly scales back to the original size.
10
- * - "out": Starts at normal size and smoothly scales up to the target zoom level.
11
+ * - "in": Starts zoomed in and smoothly scales back to the original size
12
+ * - "out": Starts at normal size and smoothly scales up to the target zoom level
11
13
  *
12
- * @param elementRef - Reference to the photo element to animate.
13
- * @param containerRef - Optional reference to a container element (required for this animation).
14
- * @param mode - Animation phase ("in" | "out").
15
- * @param duration - Duration of the zoom animation.
16
- * @param intensity - Zoom scale multiplier (default: 1.5).
14
+ * @param elementRef - Reference to the photo element to animate
15
+ * @param containerRef - Optional reference to a container element (required for this animation)
16
+ * @param mode - Animation phase ("in" | "out")
17
+ * @param duration - Duration of the zoom animation in seconds
18
+ * @param intensity - Zoom scale multiplier (default: 1.5)
19
+ *
20
+ * @example
21
+ * ```js
22
+ * // Zoom in effect
23
+ * animation: {
24
+ * name: "photo-zoom",
25
+ * mode: "in",
26
+ * duration: 2,
27
+ * intensity: 1.8
28
+ * }
29
+ *
30
+ * // Zoom out effect
31
+ * animation: {
32
+ * name: "photo-zoom",
33
+ * mode: "out",
34
+ * duration: 1.5,
35
+ * intensity: 2.0
36
+ * }
37
+ * ```
17
38
  */
18
39
  export const PhotoZoomAnimation = {
19
40
  name: "photo-zoom",
20
41
 
21
42
  /**
22
43
  * Generator function controlling the photo zoom animation.
44
+ * Handles smooth scaling transitions for zoom effects on photo elements.
45
+ *
46
+ * @param params - Animation parameters including element references and zoom settings
47
+ * @returns Generator that controls the photo zoom animation timeline
48
+ *
49
+ * @example
50
+ * ```js
51
+ * yield* PhotoZoomAnimation.run({
52
+ * elementRef: photoElement,
53
+ * containerRef: container,
54
+ * mode: "in",
55
+ * duration: 2,
56
+ * intensity: 1.5
57
+ * });
58
+ * ```
23
59
  */
24
60
  *run({
25
61
  elementRef,