visualfries 0.1.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/DIContainer.d.ts +4 -0
- package/dist/DIContainer.js +145 -0
- package/dist/SceneBuilder.svelte.d.ts +8574 -0
- package/dist/SceneBuilder.svelte.js +409 -0
- package/dist/adapters/subtitleHelpers.d.ts +2 -0
- package/dist/adapters/subtitleHelpers.js +187 -0
- package/dist/animations/AnimationContext.d.ts +17 -0
- package/dist/animations/AnimationContext.js +72 -0
- package/dist/animations/AnimationPresetsRegister.d.ts +362 -0
- package/dist/animations/AnimationPresetsRegister.js +20 -0
- package/dist/animations/AnimationSetup.d.ts +8 -0
- package/dist/animations/AnimationSetup.js +30 -0
- package/dist/animations/SplitTextCache.d.ts +28 -0
- package/dist/animations/SplitTextCache.js +68 -0
- package/dist/animations/animationBuilder.d.ts +31 -0
- package/dist/animations/animationBuilder.js +255 -0
- package/dist/animations/animationPreset.d.ts +7 -0
- package/dist/animations/animationPreset.js +31 -0
- package/dist/animations/builders/AnimationPresetFactory.d.ts +43 -0
- package/dist/animations/builders/AnimationPresetFactory.js +139 -0
- package/dist/animations/builders/LineHighlighterAnimationBuilder.d.ts +16 -0
- package/dist/animations/builders/LineHighlighterAnimationBuilder.js +183 -0
- package/dist/animations/builders/WordHighlighterAnimationBuilder.d.ts +15 -0
- package/dist/animations/builders/WordHighlighterAnimationBuilder.js +180 -0
- package/dist/animations/engines/AnimationEngineAdaptor.d.ts +107 -0
- package/dist/animations/engines/AnimationEngineAdaptor.js +1 -0
- package/dist/animations/engines/GSAPEngineAdaptor.d.ts +21 -0
- package/dist/animations/engines/GSAPEngineAdaptor.js +145 -0
- package/dist/animations/presets/index.d.ts +2 -0
- package/dist/animations/presets/index.js +3 -0
- package/dist/animations/presets/lines.d.ts +52 -0
- package/dist/animations/presets/lines.js +547 -0
- package/dist/animations/presets/words.d.ts +31 -0
- package/dist/animations/presets/words.js +268 -0
- package/dist/animations/transformers/AnimationReferenceTransformer.d.ts +9 -0
- package/dist/animations/transformers/AnimationReferenceTransformer.js +114 -0
- package/dist/builders/PixiComponentBuilder.d.ts +63 -0
- package/dist/builders/PixiComponentBuilder.js +112 -0
- package/dist/builders/_ComponentState.svelte.d.ts +795 -0
- package/dist/builders/_ComponentState.svelte.js +203 -0
- package/dist/builders/html/HtmlBuilder.d.ts +66 -0
- package/dist/builders/html/HtmlBuilder.js +171 -0
- package/dist/builders/html/HtmlBuilderFactory.d.ts +27 -0
- package/dist/builders/html/HtmlBuilderFactory.js +30 -0
- package/dist/builders/html/StyleBuilder.d.ts +13 -0
- package/dist/builders/html/StyleBuilder.js +133 -0
- package/dist/builders/html/StyleProcessor.d.ts +9 -0
- package/dist/builders/html/StyleProcessor.js +1 -0
- package/dist/builders/html/TextComponentHtmlBuilder.d.ts +16 -0
- package/dist/builders/html/TextComponentHtmlBuilder.js +93 -0
- package/dist/builders/html/TextShadowBuilder.d.ts +60 -0
- package/dist/builders/html/TextShadowBuilder.js +227 -0
- package/dist/builders/html/processors/AppearanceStyleProcessor.d.ts +5 -0
- package/dist/builders/html/processors/AppearanceStyleProcessor.js +57 -0
- package/dist/builders/html/processors/TextAppearanceStyleProcessor.d.ts +5 -0
- package/dist/builders/html/processors/TextAppearanceStyleProcessor.js +37 -0
- package/dist/builders/html/processors/TextEffectsStyleProcessor.d.ts +6 -0
- package/dist/builders/html/processors/TextEffectsStyleProcessor.js +68 -0
- package/dist/commands/Command.d.ts +6 -0
- package/dist/commands/Command.js +1 -0
- package/dist/commands/CommandRunner.d.ts +28 -0
- package/dist/commands/CommandRunner.js +81 -0
- package/dist/commands/CommandTypes.d.ts +11 -0
- package/dist/commands/CommandTypes.js +13 -0
- package/dist/commands/PauseCommand.d.ts +4 -0
- package/dist/commands/PauseCommand.js +5 -0
- package/dist/commands/PlayCommand.d.ts +4 -0
- package/dist/commands/PlayCommand.js +6 -0
- package/dist/commands/RenderCommand.d.ts +15 -0
- package/dist/commands/RenderCommand.js +18 -0
- package/dist/commands/RenderFrameCommand.d.ts +17 -0
- package/dist/commands/RenderFrameCommand.js +93 -0
- package/dist/commands/ReplaceSourceOnTimeCommand.d.ts +4 -0
- package/dist/commands/ReplaceSourceOnTimeCommand.js +22 -0
- package/dist/commands/SeekCommand.d.ts +15 -0
- package/dist/commands/SeekCommand.js +39 -0
- package/dist/commands/UpdateComponentCommand.d.ts +4 -0
- package/dist/commands/UpdateComponentCommand.js +17 -0
- package/dist/components/AnimatedGIF.d.ts +201 -0
- package/dist/components/AnimatedGIF.js +391 -0
- package/dist/components/Component.svelte.d.ts +33 -0
- package/dist/components/Component.svelte.js +152 -0
- package/dist/components/ComponentContext.svelte.d.ts +33 -0
- package/dist/components/ComponentContext.svelte.js +105 -0
- package/dist/components/hooks/AnimationHook.d.ts +25 -0
- package/dist/components/hooks/AnimationHook.js +180 -0
- package/dist/components/hooks/CanvasShapeHook.d.ts +12 -0
- package/dist/components/hooks/CanvasShapeHook.js +229 -0
- package/dist/components/hooks/HtmlAnimationHook.d.ts +8 -0
- package/dist/components/hooks/HtmlAnimationHook.js +70 -0
- package/dist/components/hooks/HtmlTextHook.d.ts +16 -0
- package/dist/components/hooks/HtmlTextHook.js +102 -0
- package/dist/components/hooks/HtmlToCanvasHook.d.ts +16 -0
- package/dist/components/hooks/HtmlToCanvasHook.js +148 -0
- package/dist/components/hooks/ImageHook.d.ts +10 -0
- package/dist/components/hooks/ImageHook.js +45 -0
- package/dist/components/hooks/MediaHook.d.ts +15 -0
- package/dist/components/hooks/MediaHook.js +252 -0
- package/dist/components/hooks/MediaSeekingHook.d.ts +12 -0
- package/dist/components/hooks/MediaSeekingHook.js +204 -0
- package/dist/components/hooks/PixiDisplayObjectHook.d.ts +15 -0
- package/dist/components/hooks/PixiDisplayObjectHook.js +77 -0
- package/dist/components/hooks/PixiGifHook.d.ts +15 -0
- package/dist/components/hooks/PixiGifHook.js +97 -0
- package/dist/components/hooks/PixiProgressShapeHook.d.ts +12 -0
- package/dist/components/hooks/PixiProgressShapeHook.js +128 -0
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.d.ts +21 -0
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.js +210 -0
- package/dist/components/hooks/PixiTextureHook.d.ts +7 -0
- package/dist/components/hooks/PixiTextureHook.js +29 -0
- package/dist/components/hooks/PixiVideoTextureHook.d.ts +10 -0
- package/dist/components/hooks/PixiVideoTextureHook.js +35 -0
- package/dist/components/hooks/SubtitlesHook.d.ts +88 -0
- package/dist/components/hooks/SubtitlesHook.js +199 -0
- package/dist/components/hooks/VerifyGifHook.d.ts +7 -0
- package/dist/components/hooks/VerifyGifHook.js +27 -0
- package/dist/components/hooks/VerifyImageHook.d.ts +7 -0
- package/dist/components/hooks/VerifyImageHook.js +27 -0
- package/dist/components/hooks/VerifyMediaHook.d.ts +7 -0
- package/dist/components/hooks/VerifyMediaHook.js +21 -0
- package/dist/components/hooks/shapes/progress/CustomProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/CustomProgressRenderer.js +53 -0
- package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.js +69 -0
- package/dist/components/hooks/shapes/progress/LinearProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/LinearProgressRenderer.js +60 -0
- package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.d.ts +9 -0
- package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.js +213 -0
- package/dist/components/hooks/shapes/progress/ProgressRenderer.d.ts +17 -0
- package/dist/components/hooks/shapes/progress/ProgressRenderer.js +75 -0
- package/dist/components/hooks/shapes/progress/RadialProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/RadialProgressRenderer.js +50 -0
- package/dist/components/hooks/shapes/progress/index.d.ts +6 -0
- package/dist/components/hooks/shapes/progress/index.js +6 -0
- package/dist/composers/componentComposer.d.ts +55 -0
- package/dist/composers/componentComposer.js +118 -0
- package/dist/composers/layerComposer.d.ts +46 -0
- package/dist/composers/layerComposer.js +79 -0
- package/dist/composers/sceneComposer.d.ts +48 -0
- package/dist/composers/sceneComposer.js +92 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +14 -0
- package/dist/directors/ComponentDirector.d.ts +20 -0
- package/dist/directors/ComponentDirector.js +86 -0
- package/dist/factories/SceneBuilderFactory.d.ts +15 -0
- package/dist/factories/SceneBuilderFactory.js +51 -0
- package/dist/fonts/GoogleFontsProvider.d.ts +12 -0
- package/dist/fonts/GoogleFontsProvider.js +125 -0
- package/dist/fonts/fontLoader.d.ts +15 -0
- package/dist/fonts/fontLoader.js +41 -0
- package/dist/fonts/types.d.ts +1 -0
- package/dist/fonts/types.js +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14 -0
- package/dist/layers/Layer.svelte.d.ts +8492 -0
- package/dist/layers/Layer.svelte.js +125 -0
- package/dist/managers/AppManager.svelte.d.ts +23 -0
- package/dist/managers/AppManager.svelte.js +89 -0
- package/dist/managers/ComponentsManager.svelte.d.ts +49 -0
- package/dist/managers/ComponentsManager.svelte.js +247 -0
- package/dist/managers/DomManager.d.ts +18 -0
- package/dist/managers/DomManager.js +73 -0
- package/dist/managers/EventManager.d.ts +7 -0
- package/dist/managers/EventManager.js +22 -0
- package/dist/managers/LayersManager.svelte.d.ts +8499 -0
- package/dist/managers/LayersManager.svelte.js +176 -0
- package/dist/managers/MediaManager.d.ts +32 -0
- package/dist/managers/MediaManager.js +243 -0
- package/dist/managers/RenderManager.d.ts +23 -0
- package/dist/managers/RenderManager.js +59 -0
- package/dist/managers/StateManager.svelte.d.ts +8746 -0
- package/dist/managers/StateManager.svelte.js +272 -0
- package/dist/managers/SubtitlesManager.svelte.d.ts +261 -0
- package/dist/managers/SubtitlesManager.svelte.js +1385 -0
- package/dist/managers/TimeManager.svelte.d.ts +6 -0
- package/dist/managers/TimeManager.svelte.js +18 -0
- package/dist/managers/TimelineManager.svelte.d.ts +25 -0
- package/dist/managers/TimelineManager.svelte.js +152 -0
- package/dist/registers.d.ts +12 -0
- package/dist/registers.js +29 -0
- package/dist/schemas/runtime/index.d.ts +3 -0
- package/dist/schemas/runtime/index.js +4 -0
- package/dist/schemas/runtime/types.d.ts +323 -0
- package/dist/schemas/runtime/types.js +12 -0
- package/dist/schemas/scene/animations.d.ts +89738 -0
- package/dist/schemas/scene/animations.js +211 -0
- package/dist/schemas/scene/components.js +515 -0
- package/dist/schemas/scene/core.js +160 -0
- package/dist/schemas/scene/index.d.ts +22 -0
- package/dist/schemas/scene/index.js +10 -0
- package/dist/schemas/scene/properties.d.ts +914 -0
- package/dist/schemas/scene/properties.js +398 -0
- package/dist/schemas/scene/subtitles.d.ts +1141 -0
- package/dist/schemas/scene/subtitles.js +111 -0
- package/dist/schemas/scene/utils.d.ts +1 -0
- package/dist/schemas/scene/utils.js +5 -0
- package/dist/seeds/SeedFactory.d.ts +59 -0
- package/dist/seeds/SeedFactory.js +99 -0
- package/dist/seeds/index.d.ts +8 -0
- package/dist/seeds/index.js +8 -0
- package/dist/transformers/ColorTransformer.d.ts +5 -0
- package/dist/transformers/ColorTransformer.js +67 -0
- package/dist/transformers/PixiColorTransformer.d.ts +22 -0
- package/dist/transformers/PixiColorTransformer.js +104 -0
- package/dist/utils/canvas.d.ts +6 -0
- package/dist/utils/canvas.js +18 -0
- package/dist/utils/document.d.ts +2 -0
- package/dist/utils/document.js +36 -0
- package/dist/utils/emoji.d.ts +10 -0
- package/dist/utils/emoji.js +51 -0
- package/dist/utils/html.d.ts +4 -0
- package/dist/utils/html.js +45 -0
- package/dist/utils/svgGenerator.d.ts +20 -0
- package/dist/utils/svgGenerator.js +103 -0
- package/dist/utils/utils.d.ts +5 -0
- package/dist/utils/utils.js +125 -0
- package/package.json +96 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Words highlighter animation preset
|
|
3
|
+
* Highlights words within text
|
|
4
|
+
*/
|
|
5
|
+
export const wordsHighlighter = {
|
|
6
|
+
id: 'words-highlight',
|
|
7
|
+
presetId: 'words-highlight',
|
|
8
|
+
description: 'Highlights individual words with a custom color',
|
|
9
|
+
data: {},
|
|
10
|
+
setup: [{ type: 'splitText', by: 'words' }],
|
|
11
|
+
timeline: [
|
|
12
|
+
{
|
|
13
|
+
target: 'words',
|
|
14
|
+
tweens: [
|
|
15
|
+
{
|
|
16
|
+
method: 'to',
|
|
17
|
+
vars: {
|
|
18
|
+
color: 'yellow', // Default color that can be overridden
|
|
19
|
+
duration: 0.15,
|
|
20
|
+
stagger: {
|
|
21
|
+
type: 'fromData',
|
|
22
|
+
dataKey: 'wordStartTimes'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Words animation preset 1
|
|
32
|
+
* Brings words in with a scale animation
|
|
33
|
+
*/
|
|
34
|
+
export const words1 = {
|
|
35
|
+
id: 'words-1',
|
|
36
|
+
description: 'Scales and fades in words with a nice bounce effect, then fades them out',
|
|
37
|
+
data: {},
|
|
38
|
+
setup: [
|
|
39
|
+
{ type: 'style', properties: { flexDirection: 'column' } },
|
|
40
|
+
{ type: 'splitText', by: 'words' }
|
|
41
|
+
],
|
|
42
|
+
timeline: [
|
|
43
|
+
{
|
|
44
|
+
target: 'words',
|
|
45
|
+
tweens: [
|
|
46
|
+
{
|
|
47
|
+
method: 'fromTo',
|
|
48
|
+
vars: {
|
|
49
|
+
from: {
|
|
50
|
+
opacity: 0,
|
|
51
|
+
scale: 0.3,
|
|
52
|
+
y: '50%',
|
|
53
|
+
yPercent: -50
|
|
54
|
+
},
|
|
55
|
+
opacity: 1,
|
|
56
|
+
scale: 1,
|
|
57
|
+
y: '50%',
|
|
58
|
+
yPercent: -50,
|
|
59
|
+
ease: 'back.out(5)',
|
|
60
|
+
stagger: 0.15
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
target: 'words',
|
|
67
|
+
position: '>+=2', // 2 seconds after the first animation completes
|
|
68
|
+
tweens: [
|
|
69
|
+
{
|
|
70
|
+
method: 'to',
|
|
71
|
+
vars: {
|
|
72
|
+
opacity: 0,
|
|
73
|
+
scale: 0,
|
|
74
|
+
y: '50%',
|
|
75
|
+
ease: 'power4.out',
|
|
76
|
+
stagger: 0.05
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Words animation preset with no overflow
|
|
85
|
+
* Text animates from below with a sliding effect
|
|
86
|
+
*/
|
|
87
|
+
export const words2 = {
|
|
88
|
+
id: 'words-no-overflow',
|
|
89
|
+
description: 'Fades in words sliding up from below without overflow',
|
|
90
|
+
data: {},
|
|
91
|
+
setup: [
|
|
92
|
+
{ type: 'style', properties: { flexDirection: 'column' } },
|
|
93
|
+
{ type: 'splitText', by: 'words' }
|
|
94
|
+
],
|
|
95
|
+
timeline: [
|
|
96
|
+
{
|
|
97
|
+
target: 'words',
|
|
98
|
+
tweens: [
|
|
99
|
+
{
|
|
100
|
+
method: 'fromTo',
|
|
101
|
+
vars: {
|
|
102
|
+
from: {
|
|
103
|
+
opacity: 0,
|
|
104
|
+
y: '50%',
|
|
105
|
+
yPercent: 150
|
|
106
|
+
},
|
|
107
|
+
opacity: 1,
|
|
108
|
+
y: '50%',
|
|
109
|
+
yPercent: -50,
|
|
110
|
+
ease: 'power3.out',
|
|
111
|
+
stagger: 0.1
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
target: 'words',
|
|
118
|
+
position: '>+=2',
|
|
119
|
+
tweens: [
|
|
120
|
+
{
|
|
121
|
+
method: 'to',
|
|
122
|
+
vars: {
|
|
123
|
+
opacity: 0,
|
|
124
|
+
y: '50%',
|
|
125
|
+
yPercent: -200,
|
|
126
|
+
ease: 'power3.in',
|
|
127
|
+
stagger: 0.05
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Subtitles rising back animation
|
|
136
|
+
* Words fade in with a nice back ease
|
|
137
|
+
*/
|
|
138
|
+
export const subtitlesRisingBack = {
|
|
139
|
+
id: 'subtitles-rising-back',
|
|
140
|
+
description: 'Words rise from bottom with a nice bounce effect',
|
|
141
|
+
data: {
|
|
142
|
+
// This preset can work with word timings provided by the consumer
|
|
143
|
+
wordStartTimes: [0, 0.1, 0.2, 0.3, 0.4]
|
|
144
|
+
},
|
|
145
|
+
setup: [
|
|
146
|
+
{ type: 'splitText', by: 'words' }
|
|
147
|
+
// { type: 'style', properties: { opacity: 0 } }
|
|
148
|
+
],
|
|
149
|
+
timeline: [
|
|
150
|
+
{
|
|
151
|
+
target: 'words',
|
|
152
|
+
tweens: [
|
|
153
|
+
{
|
|
154
|
+
method: 'fromTo',
|
|
155
|
+
vars: {
|
|
156
|
+
from: {
|
|
157
|
+
opacity: 0,
|
|
158
|
+
scale: 0
|
|
159
|
+
},
|
|
160
|
+
opacity: 1,
|
|
161
|
+
scale: 1,
|
|
162
|
+
ease: 'back.out',
|
|
163
|
+
stagger: {
|
|
164
|
+
type: 'fromData',
|
|
165
|
+
dataKey: 'wordStartTimes'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Words highlight animation preset
|
|
175
|
+
* Gradually highlights words one by one
|
|
176
|
+
*/
|
|
177
|
+
export const words3 = {
|
|
178
|
+
id: 'words-highlight',
|
|
179
|
+
description: 'Gradually highlights words by increasing opacity',
|
|
180
|
+
data: {},
|
|
181
|
+
setup: [
|
|
182
|
+
{ type: 'style', properties: { flexDirection: 'column' } },
|
|
183
|
+
{ type: 'splitText', by: 'words' }
|
|
184
|
+
],
|
|
185
|
+
timeline: [
|
|
186
|
+
{
|
|
187
|
+
target: 'words',
|
|
188
|
+
tweens: [
|
|
189
|
+
{
|
|
190
|
+
method: 'fromTo',
|
|
191
|
+
vars: {
|
|
192
|
+
from: {
|
|
193
|
+
opacity: 0.4,
|
|
194
|
+
y: '50%',
|
|
195
|
+
yPercent: -50
|
|
196
|
+
},
|
|
197
|
+
opacity: 1,
|
|
198
|
+
ease: 'power3.out',
|
|
199
|
+
stagger: 0.4
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
target: 'words',
|
|
206
|
+
position: '>+=2',
|
|
207
|
+
tweens: [
|
|
208
|
+
{
|
|
209
|
+
method: 'to',
|
|
210
|
+
vars: {
|
|
211
|
+
opacity: 0,
|
|
212
|
+
y: '50%',
|
|
213
|
+
ease: 'power4.out',
|
|
214
|
+
stagger: 0.1
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Words active color animation preset
|
|
223
|
+
* Reveals words one by one with individual highlighting
|
|
224
|
+
*/
|
|
225
|
+
export const words4 = {
|
|
226
|
+
id: 'words-active-color',
|
|
227
|
+
description: 'Reveals and highlights words one by one with color changes',
|
|
228
|
+
data: {},
|
|
229
|
+
setup: [
|
|
230
|
+
{ type: 'style', properties: { flexDirection: 'column' } },
|
|
231
|
+
{ type: 'splitText', by: 'words' }
|
|
232
|
+
],
|
|
233
|
+
timeline: [
|
|
234
|
+
{
|
|
235
|
+
target: 'words',
|
|
236
|
+
tweens: [
|
|
237
|
+
{
|
|
238
|
+
method: 'fromTo',
|
|
239
|
+
vars: {
|
|
240
|
+
from: {
|
|
241
|
+
opacity: 0,
|
|
242
|
+
y: '50%',
|
|
243
|
+
yPercent: -50
|
|
244
|
+
},
|
|
245
|
+
opacity: 1,
|
|
246
|
+
ease: 'power3.out',
|
|
247
|
+
stagger: 0.4
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
target: 'words',
|
|
254
|
+
position: '>+=2',
|
|
255
|
+
tweens: [
|
|
256
|
+
{
|
|
257
|
+
method: 'to',
|
|
258
|
+
vars: {
|
|
259
|
+
opacity: 0,
|
|
260
|
+
y: '50%',
|
|
261
|
+
ease: 'power4.out',
|
|
262
|
+
stagger: 0.1
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AnimationPreset } from '../..';
|
|
2
|
+
import type { AnimationPresetsRegister } from '../AnimationPresetsRegister.js';
|
|
3
|
+
export declare class ComponentAnimationTransformer {
|
|
4
|
+
private animationPresetsRegister;
|
|
5
|
+
constructor(cradle: {
|
|
6
|
+
animationPresetsRegister: AnimationPresetsRegister;
|
|
7
|
+
});
|
|
8
|
+
handle(input: unknown): AnimationPreset | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { AnimationPresetShape, KeyframeAnimationShape } from '../..';
|
|
2
|
+
class AbstractNormalizationHandler {
|
|
3
|
+
nextHandler = null;
|
|
4
|
+
setNext(handler) {
|
|
5
|
+
this.nextHandler = handler;
|
|
6
|
+
return handler; // Allows chaining like handler1.setNext(handler2).setNext(handler3)
|
|
7
|
+
}
|
|
8
|
+
handle(input, registry) {
|
|
9
|
+
if (this.canHandle(input)) {
|
|
10
|
+
return this.normalize(input, registry);
|
|
11
|
+
}
|
|
12
|
+
else if (this.nextHandler) {
|
|
13
|
+
return this.nextHandler.handle(input, registry);
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class StringPresetHandler extends AbstractNormalizationHandler {
|
|
19
|
+
canHandle(input) {
|
|
20
|
+
return typeof input === 'string';
|
|
21
|
+
}
|
|
22
|
+
normalize(input, registry) {
|
|
23
|
+
const presetName = input;
|
|
24
|
+
const preset = registry.get(presetName);
|
|
25
|
+
if (!preset) {
|
|
26
|
+
console.warn(`StringPresetHandler: Preset "${presetName}" not found.`);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
// Optional: validate preset from registry
|
|
30
|
+
const parseResult = AnimationPresetShape.safeParse(preset);
|
|
31
|
+
if (!parseResult.success) {
|
|
32
|
+
console.warn(`StringPresetHandler: Preset "${presetName}" from registry is invalid.`, parseResult.error.flatten());
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return parseResult.data;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class KeyframePresetHandler extends AbstractNormalizationHandler {
|
|
39
|
+
canHandle(input) {
|
|
40
|
+
// More robust than 'tween' in input, use Zod to check shape
|
|
41
|
+
return KeyframeAnimationShape.safeParse(input).success;
|
|
42
|
+
}
|
|
43
|
+
normalize(input, _registry) {
|
|
44
|
+
const parseResult = KeyframeAnimationShape.safeParse(input);
|
|
45
|
+
if (!parseResult.success) {
|
|
46
|
+
// Should have been caught by canHandle, but good practice
|
|
47
|
+
console.warn('KeyframePresetHandler: Input is not a valid KeyframeAnimationShape.', parseResult.error.flatten());
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const keyframeAnim = parseResult.data;
|
|
51
|
+
const presetId = keyframeAnim.id || `keyframe-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
|
|
52
|
+
const fullPresetObject = {
|
|
53
|
+
id: presetId,
|
|
54
|
+
data: { componentDuration: 0 },
|
|
55
|
+
setup: [],
|
|
56
|
+
timeline: [
|
|
57
|
+
{
|
|
58
|
+
target: keyframeAnim.target || 'container',
|
|
59
|
+
tweens: [keyframeAnim.tween]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
const normalizedValidation = AnimationPresetShape.safeParse(fullPresetObject);
|
|
64
|
+
if (!normalizedValidation.success) {
|
|
65
|
+
console.error('KeyframePresetHandler: Failed to normalize keyframe to valid AnimationPresetShape.', normalizedValidation.error.flatten());
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return normalizedValidation.data;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class FullPresetHandler extends AbstractNormalizationHandler {
|
|
72
|
+
canHandle(input) {
|
|
73
|
+
const resp = AnimationPresetShape.safeParse(input);
|
|
74
|
+
if (!resp.success) {
|
|
75
|
+
// console.warn('FullPresetHandler: Input is not a valid AnimationPresetShape.', resp.error);
|
|
76
|
+
}
|
|
77
|
+
return AnimationPresetShape.safeParse(input).success;
|
|
78
|
+
}
|
|
79
|
+
normalize(input, _registry) {
|
|
80
|
+
const parseResult = AnimationPresetShape.safeParse(input);
|
|
81
|
+
if (!parseResult.success) {
|
|
82
|
+
// Should have been caught by canHandle
|
|
83
|
+
// console.warn(
|
|
84
|
+
// 'FullPresetHandler: Input is not a valid AnimationPresetShape.',
|
|
85
|
+
// parseResult.error.flatten()
|
|
86
|
+
// );
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return parseResult.data;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export class ComponentAnimationTransformer {
|
|
93
|
+
animationPresetsRegister;
|
|
94
|
+
constructor(cradle) {
|
|
95
|
+
this.animationPresetsRegister = cradle.animationPresetsRegister;
|
|
96
|
+
}
|
|
97
|
+
handle(input) {
|
|
98
|
+
const stringHandler = new StringPresetHandler();
|
|
99
|
+
const keyframeHandler = new KeyframePresetHandler();
|
|
100
|
+
const fullPresetHandler = new FullPresetHandler();
|
|
101
|
+
// Define the chain: Order matters!
|
|
102
|
+
// String is most specific, then keyframe (subset of object), then full object.
|
|
103
|
+
stringHandler.setNext(keyframeHandler).setNext(fullPresetHandler);
|
|
104
|
+
const normalizedPreset = stringHandler.handle(input, this.animationPresetsRegister.getPresets()); // TODO fill registry
|
|
105
|
+
if (!normalizedPreset) {
|
|
106
|
+
// console.warn(
|
|
107
|
+
// 'normalizeAnimationReferenceWithPattern: Input animation reference does not match any known format or failed normalization.',
|
|
108
|
+
// input
|
|
109
|
+
// );
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return normalizedPreset;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { IComponent, IComponentBuilder, IComponentHook as ComponentHook } from '..';
|
|
2
|
+
import { Component } from '../components/Component.svelte.js';
|
|
3
|
+
type PixiComponentCradle = {
|
|
4
|
+
component: Component;
|
|
5
|
+
mediaHook: ComponentHook;
|
|
6
|
+
verifyMediaHook: ComponentHook;
|
|
7
|
+
imageHook: ComponentHook;
|
|
8
|
+
verifyImageHook: ComponentHook;
|
|
9
|
+
verifyGifHook: ComponentHook;
|
|
10
|
+
videoTextureHook: ComponentHook;
|
|
11
|
+
splitScreenHook: ComponentHook;
|
|
12
|
+
htmlTextHook: ComponentHook;
|
|
13
|
+
htmlAnimationHook: ComponentHook;
|
|
14
|
+
animationHook: ComponentHook;
|
|
15
|
+
subtitlesHook: ComponentHook;
|
|
16
|
+
textureHook: ComponentHook;
|
|
17
|
+
objectHook: ComponentHook;
|
|
18
|
+
gifHook: ComponentHook;
|
|
19
|
+
canvasShapeHook: ComponentHook;
|
|
20
|
+
pixiProgressShapeHook: ComponentHook;
|
|
21
|
+
htmlToCanvasHook: ComponentHook;
|
|
22
|
+
mediaSeekingHook: ComponentHook;
|
|
23
|
+
};
|
|
24
|
+
export declare class PixiComponentBuilder implements IComponentBuilder {
|
|
25
|
+
private component;
|
|
26
|
+
private mediaHook;
|
|
27
|
+
private verifyMediaHook;
|
|
28
|
+
private imageHook;
|
|
29
|
+
private verifyImageHook;
|
|
30
|
+
private verifyGifHook;
|
|
31
|
+
private videoTextureHook;
|
|
32
|
+
private splitScreenHook;
|
|
33
|
+
private htmlTextHook;
|
|
34
|
+
private htmlAnimationHook;
|
|
35
|
+
private subtitlesHook;
|
|
36
|
+
private textureHook;
|
|
37
|
+
private objectHook;
|
|
38
|
+
private gifHook;
|
|
39
|
+
private canvasShapeHook;
|
|
40
|
+
private pixiProgressShapeHook;
|
|
41
|
+
private htmlToCanvasHook;
|
|
42
|
+
private animationHook;
|
|
43
|
+
private mediaSeekingHook;
|
|
44
|
+
constructor(cradle: PixiComponentCradle);
|
|
45
|
+
withCanvasShape(): this;
|
|
46
|
+
withProgressShape(): this;
|
|
47
|
+
withMedia(): this;
|
|
48
|
+
withMediaSeeking(): this;
|
|
49
|
+
withImage(): this;
|
|
50
|
+
withTexture(): this;
|
|
51
|
+
withDisplayObject(): this;
|
|
52
|
+
withVideoTexture(): this;
|
|
53
|
+
withSplitScreen(): this;
|
|
54
|
+
withHtmlText(): this;
|
|
55
|
+
withAnimation(): this;
|
|
56
|
+
withHtmlAnimation(): this;
|
|
57
|
+
withHtmlToCanvasHook(): this;
|
|
58
|
+
withSubtitles(): this;
|
|
59
|
+
withGif(): this;
|
|
60
|
+
withShape(): this;
|
|
61
|
+
getComponent(): IComponent;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Component } from '../components/Component.svelte.js';
|
|
2
|
+
export class PixiComponentBuilder {
|
|
3
|
+
component;
|
|
4
|
+
mediaHook;
|
|
5
|
+
verifyMediaHook;
|
|
6
|
+
imageHook;
|
|
7
|
+
verifyImageHook;
|
|
8
|
+
verifyGifHook;
|
|
9
|
+
videoTextureHook;
|
|
10
|
+
splitScreenHook;
|
|
11
|
+
htmlTextHook;
|
|
12
|
+
htmlAnimationHook;
|
|
13
|
+
subtitlesHook;
|
|
14
|
+
textureHook;
|
|
15
|
+
objectHook;
|
|
16
|
+
gifHook;
|
|
17
|
+
canvasShapeHook;
|
|
18
|
+
pixiProgressShapeHook;
|
|
19
|
+
htmlToCanvasHook;
|
|
20
|
+
animationHook;
|
|
21
|
+
mediaSeekingHook;
|
|
22
|
+
constructor(cradle) {
|
|
23
|
+
this.component = cradle.component;
|
|
24
|
+
this.mediaHook = cradle.mediaHook;
|
|
25
|
+
this.verifyMediaHook = cradle.verifyMediaHook;
|
|
26
|
+
this.imageHook = cradle.imageHook;
|
|
27
|
+
this.verifyImageHook = cradle.verifyImageHook;
|
|
28
|
+
this.verifyGifHook = cradle.verifyGifHook;
|
|
29
|
+
this.videoTextureHook = cradle.videoTextureHook;
|
|
30
|
+
this.splitScreenHook = cradle.splitScreenHook;
|
|
31
|
+
this.htmlTextHook = cradle.htmlTextHook;
|
|
32
|
+
this.htmlAnimationHook = cradle.htmlAnimationHook;
|
|
33
|
+
this.animationHook = cradle.animationHook;
|
|
34
|
+
this.subtitlesHook = cradle.subtitlesHook;
|
|
35
|
+
this.textureHook = cradle.textureHook;
|
|
36
|
+
this.objectHook = cradle.objectHook;
|
|
37
|
+
this.gifHook = cradle.gifHook;
|
|
38
|
+
this.canvasShapeHook = cradle.canvasShapeHook;
|
|
39
|
+
this.pixiProgressShapeHook = cradle.pixiProgressShapeHook;
|
|
40
|
+
this.htmlToCanvasHook = cradle.htmlToCanvasHook;
|
|
41
|
+
this.mediaSeekingHook = cradle.mediaSeekingHook;
|
|
42
|
+
}
|
|
43
|
+
withCanvasShape() {
|
|
44
|
+
this.component.addHook(this.canvasShapeHook);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
withProgressShape() {
|
|
48
|
+
this.component.addHook(this.pixiProgressShapeHook);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
withMedia() {
|
|
52
|
+
this.component.addHook(this.verifyMediaHook);
|
|
53
|
+
this.component.addHook(this.mediaHook);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
withMediaSeeking() {
|
|
57
|
+
this.component.addHook(this.mediaSeekingHook);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
withImage() {
|
|
61
|
+
this.component.addHook(this.verifyImageHook);
|
|
62
|
+
this.component.addHook(this.imageHook);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
withTexture() {
|
|
66
|
+
this.component.addHook(this.textureHook);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
withDisplayObject() {
|
|
70
|
+
this.component.addHook(this.objectHook);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
withVideoTexture() {
|
|
74
|
+
this.component.addHook(this.videoTextureHook);
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
withSplitScreen() {
|
|
78
|
+
this.component.addHook(this.splitScreenHook);
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
withHtmlText() {
|
|
82
|
+
this.component.addHook(this.htmlTextHook);
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
withAnimation() {
|
|
86
|
+
this.component.addHook(this.animationHook);
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
withHtmlAnimation() {
|
|
90
|
+
this.component.addHook(this.htmlAnimationHook);
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
withHtmlToCanvasHook() {
|
|
94
|
+
this.component.addHook(this.htmlToCanvasHook);
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
withSubtitles() {
|
|
98
|
+
this.component.addHook(this.subtitlesHook);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
withGif() {
|
|
102
|
+
this.component.addHook(this.verifyGifHook);
|
|
103
|
+
this.component.addHook(this.gifHook);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
withShape() {
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
getComponent() {
|
|
110
|
+
return this.component;
|
|
111
|
+
}
|
|
112
|
+
}
|