@twick/visualizer 0.15.14 → 0.15.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twick/visualizer",
3
- "version": "0.15.14",
3
+ "version": "0.15.15",
4
4
  "license": "https://github.com/ncounterspecialist/twick/blob/main/LICENSE.md",
5
5
  "scripts": {
6
6
  "start": "twick editor --projectFile ./src/live.tsx",
@@ -22,18 +22,18 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@preact/signals": "^1.2.1",
25
- "@twick/2d": "^0.15.14",
26
- "@twick/core": "^0.15.14",
27
- "@twick/renderer": "^0.15.14",
28
- "@twick/vite-plugin": "^0.15.14",
25
+ "@twick/2d": "^0.15.15",
26
+ "@twick/core": "^0.15.15",
27
+ "@twick/renderer": "^0.15.15",
28
+ "@twick/vite-plugin": "^0.15.15",
29
29
  "date-fns": "^4.1.0",
30
30
  "preact": "^10.19.2",
31
31
  "crelt": "^1.0.6",
32
- "@twick/media-utils": "0.15.14"
32
+ "@twick/media-utils": "0.15.15"
33
33
  },
34
34
  "devDependencies": {
35
- "@twick/cli": "^0.15.14",
36
- "@twick/ui": "^0.15.14",
35
+ "@twick/cli": "^0.15.15",
36
+ "@twick/ui": "^0.15.15",
37
37
  "typescript": "5.4.2",
38
38
  "typedoc": "^0.25.8",
39
39
  "typedoc-plugin-markdown": "^3.17.1",
@@ -74,10 +74,10 @@ import { AnimationParams } from "../helpers/types";
74
74
  * animation: { name: "fade", animate: "enter", duration: 2 }
75
75
  * },
76
76
  * {
77
- * id: "subtitle",
77
+ * id: "caption",
78
78
  * type: "text",
79
79
  * s: 1, e: 8,
80
- * t: "Subtitle",
80
+ * t: "Caption",
81
81
  * animation: { name: "fade", animate: "enter", duration: 2 }
82
82
  * },
83
83
  * {
@@ -1,7 +1,6 @@
1
1
  import { AudioElement } from "../elements/audio.element";
2
2
  import { CaptionElement } from "../elements/caption.element";
3
3
  import { CircleElement } from "../elements/circle.element";
4
- import { IconElement } from "../elements/icon.element";
5
4
  import { ImageElement } from "../elements/image.element";
6
5
  import { RectElement } from "../elements/rect.element";
7
6
  import { SceneElement } from "../elements/scene.element";
@@ -33,7 +32,6 @@ export class ElementController {
33
32
  elementController.register(TextElement);
34
33
  elementController.register(AudioElement);
35
34
  elementController.register(CircleElement);
36
- elementController.register(IconElement);
37
35
  elementController.register(RectElement);
38
36
  }
39
37
 
@@ -10,5 +10,4 @@ export { TextElement } from './text.element';
10
10
  export { CaptionElement } from './caption.element';
11
11
  export { RectElement } from './rect.element';
12
12
  export { CircleElement } from './circle.element';
13
- export { IconElement } from './icon.element';
14
13
  export { SceneElement } from './scene.element';
@@ -55,7 +55,6 @@ export { CaptionElement } from './elements/caption.element';
55
55
  // Shape and UI elements
56
56
  export { RectElement } from './elements/rect.element';
57
57
  export { CircleElement } from './elements/circle.element';
58
- export { IconElement } from './elements/icon.element';
59
58
 
60
59
  // Special elements
61
60
  export { SceneElement } from './elements/scene.element';
@@ -134,7 +134,7 @@ export const scene = makeScene2D("scene", function* (view: View2D) {
134
134
  const movie = [];
135
135
  let index = 1;
136
136
 
137
- // Iterate through each track element and create appropriate visualization
137
+ // Iterate through each track. Z-order is determined by track order (first track = back, last = front).
138
138
  for (const track of input.tracks) {
139
139
  switch (track.type) {
140
140
  case TRACK_TYPES.VIDEO:
@@ -1,88 +0,0 @@
1
- import { ElementParams } from "../helpers/types";
2
- import { all, createRef, waitFor } from "@twick/core";
3
- import { Icon } from "@twick/2d";
4
- import { addAnimation } from "../helpers/element.utils";
5
-
6
- /**
7
- * @group IconElement
8
- * IconElement creates and manages icon elements in the visualizer scene.
9
- * Handles icon rendering, styling, and animations for UI elements and
10
- * visual design components.
11
- *
12
- * Features:
13
- * - Icon rendering with custom styling
14
- * - Size and position control
15
- * - Color and opacity customization
16
- * - Animation support
17
- *
18
- * @param containerRef - Reference to the container element
19
- * @param element - Icon element configuration and properties
20
- * @param view - The main scene view for rendering
21
- *
22
- * @example
23
- * ```js
24
- * // Basic icon element
25
- * {
26
- * id: "play-icon",
27
- * type: "icon",
28
- * s: 0,
29
- * e: 20,
30
- * props: {
31
- * icon: "play",
32
- * size: 64,
33
- * fill: "#ffffff"
34
- * }
35
- * }
36
- *
37
- * // Icon with animation
38
- * {
39
- * id: "animated-icon",
40
- * type: "icon",
41
- * s: 2,
42
- * e: 15,
43
- * props: {
44
- * icon: "pause",
45
- * size: 48,
46
- * fill: "#ff0000",
47
- * opacity: 0.8
48
- * },
49
- * animation: {
50
- * name: "fade",
51
- * animate: "enter",
52
- * duration: 2
53
- * }
54
- * }
55
- * ```
56
- */
57
- export const IconElement = {
58
- name: "icon",
59
-
60
- /**
61
- * Generator function that creates and manages icon elements in the scene.
62
- * Handles icon creation, styling, and cleanup.
63
- *
64
- * @param params - Element parameters including container reference, element config, and view
65
- * @returns Generator that controls the icon element lifecycle
66
- *
67
- * @example
68
- * ```js
69
- * yield* IconElement.create({
70
- * containerRef: mainContainer,
71
- * element: iconConfig,
72
- * view: sceneView
73
- * });
74
- * ```
75
- */
76
- *create({ containerRef, element, view }: ElementParams) {
77
- const elementRef = createRef<any>();
78
- yield* waitFor(element?.s);
79
- yield containerRef().add(
80
- <Icon ref={elementRef} key={element.id} {...element.props} />
81
- );
82
- yield* all(
83
- addAnimation({ elementRef: elementRef, element: element, view }),
84
- waitFor(Math.max(0, element.e - element.s))
85
- );
86
- yield elementRef().remove();
87
- },
88
- };