angular-three-theatre 4.0.0-next.116 → 4.0.0-next.118
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.
|
@@ -6,20 +6,110 @@ import { NgtsTransformControlsOptions } from 'angular-three-soba/gizmos';
|
|
|
6
6
|
import * as THREE from 'three';
|
|
7
7
|
import { IStudio } from '@theatre/studio';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Component that creates and manages a Theatre.js project.
|
|
11
|
+
*
|
|
12
|
+
* A Theatre.js project is the top-level container for all animation data.
|
|
13
|
+
* It contains sheets, which in turn contain sheet objects that hold animatable properties.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <theatre-project name="my-animation" [config]="{ state: savedState }">
|
|
18
|
+
* <ng-container sheet="scene1">
|
|
19
|
+
* <!-- sheet objects here -->
|
|
20
|
+
* </ng-container>
|
|
21
|
+
* </theatre-project>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
9
24
|
declare class TheatreProject {
|
|
25
|
+
/**
|
|
26
|
+
* The name of the Theatre.js project.
|
|
27
|
+
* This name is used to identify the project and must be unique.
|
|
28
|
+
*
|
|
29
|
+
* @default 'default-theatre-project'
|
|
30
|
+
*/
|
|
10
31
|
name: _angular_core.InputSignal<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the Theatre.js project.
|
|
34
|
+
* Can include saved state data for restoring animations.
|
|
35
|
+
*
|
|
36
|
+
* @default {}
|
|
37
|
+
*/
|
|
11
38
|
config: _angular_core.InputSignal<IProjectConfig>;
|
|
39
|
+
/**
|
|
40
|
+
* Computed signal containing the Theatre.js project instance.
|
|
41
|
+
*/
|
|
12
42
|
project: _angular_core.Signal<_theatre_core.IProject>;
|
|
43
|
+
/**
|
|
44
|
+
* Internal registry of sheets created within this project.
|
|
45
|
+
* Tracks sheet instances and their reference counts for cleanup.
|
|
46
|
+
*/
|
|
13
47
|
sheets: Record<string, [sheet: ISheet, count: number]>;
|
|
14
48
|
constructor();
|
|
15
49
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheatreProject, never>;
|
|
16
50
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TheatreProject, "theatre-project", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
17
51
|
}
|
|
18
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Directive that creates a Theatre.js sheet object for animating properties.
|
|
55
|
+
*
|
|
56
|
+
* A sheet object is a container for animatable properties within a sheet.
|
|
57
|
+
* This directive must be applied to an `ng-template` element and provides
|
|
58
|
+
* a structural context with access to the sheet object and its values.
|
|
59
|
+
*
|
|
60
|
+
* The template context includes:
|
|
61
|
+
* - `sheetObject`: The Theatre.js sheet object instance (read-only signal)
|
|
62
|
+
* - `values`: Current values of all animated properties (read-only signal)
|
|
63
|
+
* - `select()`: Method to select this object in Theatre.js Studio
|
|
64
|
+
* - `deselect()`: Method to deselect this object in Theatre.js Studio
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```html
|
|
68
|
+
* <ng-template sheetObject="cube" [sheetObjectProps]="{ opacity: 1 }" let-values="values">
|
|
69
|
+
* <ngt-mesh>
|
|
70
|
+
* <ngt-mesh-standard-material [opacity]="values().opacity" />
|
|
71
|
+
* </ngt-mesh>
|
|
72
|
+
* </ng-template>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```html
|
|
77
|
+
* <!-- With selection support -->
|
|
78
|
+
* <ng-template
|
|
79
|
+
* sheetObject="cube"
|
|
80
|
+
* [(sheetObjectSelected)]="isSelected"
|
|
81
|
+
* let-select="select"
|
|
82
|
+
* let-deselect="deselect"
|
|
83
|
+
* >
|
|
84
|
+
* <ngt-mesh (click)="select()" />
|
|
85
|
+
* </ng-template>
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
19
88
|
declare class TheatreSheetObject$1 {
|
|
89
|
+
/**
|
|
90
|
+
* Unique key identifying this sheet object within its parent sheet.
|
|
91
|
+
* This key is used by Theatre.js to track and persist animation data.
|
|
92
|
+
*/
|
|
20
93
|
key: _angular_core.InputSignal<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Initial properties and their default values for this sheet object.
|
|
96
|
+
* These properties will be animatable in Theatre.js Studio.
|
|
97
|
+
*
|
|
98
|
+
* @default {}
|
|
99
|
+
*/
|
|
21
100
|
props: _angular_core.InputSignal<UnknownShorthandCompoundProps>;
|
|
101
|
+
/**
|
|
102
|
+
* Whether to detach (remove) the sheet object when this directive is destroyed.
|
|
103
|
+
* When true, the animation data for this object will be removed from the sheet.
|
|
104
|
+
*
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
22
107
|
detach: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* Two-way bindable signal indicating whether this object is selected in Theatre.js Studio.
|
|
110
|
+
*
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
23
113
|
selected: _angular_core.ModelSignal<boolean>;
|
|
24
114
|
private templateRef;
|
|
25
115
|
private vcr;
|
|
@@ -27,18 +117,58 @@ declare class TheatreSheetObject$1 {
|
|
|
27
117
|
private studio;
|
|
28
118
|
private store;
|
|
29
119
|
private originalSheetObject;
|
|
120
|
+
/**
|
|
121
|
+
* Signal containing the Theatre.js sheet object instance.
|
|
122
|
+
* This is a linked signal that updates when the sheet or key changes.
|
|
123
|
+
*/
|
|
30
124
|
sheetObject: _angular_core.WritableSignal<_theatre_core.ISheetObject<UnknownShorthandCompoundProps>>;
|
|
125
|
+
/**
|
|
126
|
+
* Signal containing the current values of all animated properties.
|
|
127
|
+
* Updates automatically when Theatre.js values change.
|
|
128
|
+
*/
|
|
31
129
|
values: _angular_core.WritableSignal<{
|
|
32
130
|
[x: string]: any;
|
|
33
131
|
}>;
|
|
34
132
|
private detached;
|
|
35
133
|
private aggregatedProps;
|
|
36
134
|
constructor();
|
|
135
|
+
/**
|
|
136
|
+
* Updates the sheet object with the current aggregated props.
|
|
137
|
+
* Detaches the existing object and creates a new one with reconfigured properties.
|
|
138
|
+
*/
|
|
37
139
|
update(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Adds new properties to the sheet object.
|
|
142
|
+
* The properties are merged with existing properties and the object is reconfigured.
|
|
143
|
+
*
|
|
144
|
+
* @param props - Properties to add to the sheet object
|
|
145
|
+
*/
|
|
38
146
|
addProps(props: UnknownShorthandCompoundProps): void;
|
|
147
|
+
/**
|
|
148
|
+
* Removes properties from the sheet object.
|
|
149
|
+
* If all properties are removed and `detach` is true, the object is detached from the sheet.
|
|
150
|
+
*
|
|
151
|
+
* @param props - Array of property names to remove
|
|
152
|
+
*/
|
|
39
153
|
removeProps(props: string[]): void;
|
|
154
|
+
/**
|
|
155
|
+
* Selects this sheet object in Theatre.js Studio.
|
|
156
|
+
* Only works when the studio is available.
|
|
157
|
+
*/
|
|
40
158
|
select(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Deselects this sheet object in Theatre.js Studio.
|
|
161
|
+
* Only deselects if this object is currently selected.
|
|
162
|
+
*/
|
|
41
163
|
deselect(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Type guard for the template context.
|
|
166
|
+
* Provides type safety for the template variables exposed by this directive.
|
|
167
|
+
*
|
|
168
|
+
* @param _ - The directive instance
|
|
169
|
+
* @param ctx - The template context
|
|
170
|
+
* @returns Type predicate for the template context
|
|
171
|
+
*/
|
|
42
172
|
static ngTemplateContextGuard(_: TheatreSheetObject$1, ctx: unknown): ctx is {
|
|
43
173
|
select: TheatreSheetObject$1['select'];
|
|
44
174
|
deselect: TheatreSheetObject$1['deselect'];
|
|
@@ -50,7 +180,24 @@ declare class TheatreSheetObject$1 {
|
|
|
50
180
|
}
|
|
51
181
|
|
|
52
182
|
/**
|
|
53
|
-
|
|
183
|
+
* Type definition for a Theatre.js property transformer.
|
|
184
|
+
*
|
|
185
|
+
* Transformers are used to convert between Three.js property values and
|
|
186
|
+
* Theatre.js animation values. This allows for proper representation
|
|
187
|
+
* in the Theatre.js Studio UI (e.g., showing degrees instead of radians).
|
|
188
|
+
*
|
|
189
|
+
* Based on https://github.com/threlte/threlte/blob/main/packages/theatre/src/lib/sheetObject/transfomers/types.ts
|
|
190
|
+
*
|
|
191
|
+
* @typeParam Value - The type of the original Three.js property value
|
|
192
|
+
* @typeParam TransformedValue - The type of the value used in Theatre.js
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const myTransformer: TheatreTransformer<number, number> = {
|
|
197
|
+
* transform: (value) => types.number(value * 100),
|
|
198
|
+
* apply: (target, property, value) => { target[property] = value / 100; }
|
|
199
|
+
* };
|
|
200
|
+
* ```
|
|
54
201
|
*/
|
|
55
202
|
type TheatreTransformer<Value = any, TransformedValue = any> = {
|
|
56
203
|
/**
|
|
@@ -69,14 +216,70 @@ type TheatreTransformer<Value = any, TransformedValue = any> = {
|
|
|
69
216
|
apply: (target: any, property: string, value: TransformedValue) => void;
|
|
70
217
|
};
|
|
71
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Directive that synchronizes Three.js object properties with Theatre.js animations.
|
|
221
|
+
*
|
|
222
|
+
* This directive allows you to expose specific properties of a Three.js object
|
|
223
|
+
* to Theatre.js for animation. It automatically handles property transformation
|
|
224
|
+
* (e.g., converting Euler angles to degrees for the UI).
|
|
225
|
+
*
|
|
226
|
+
* Must be used within a `TheatreSheetObject` context.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```html
|
|
230
|
+
* <ng-template sheetObject="myMaterial">
|
|
231
|
+
* <ngt-mesh-standard-material
|
|
232
|
+
* [sync]="material"
|
|
233
|
+
* [syncProps]="['opacity', 'roughness', 'metalness']"
|
|
234
|
+
* #material
|
|
235
|
+
* />
|
|
236
|
+
* </ng-template>
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```html
|
|
241
|
+
* <!-- With custom property mapping -->
|
|
242
|
+
* <ng-template sheetObject="myLight">
|
|
243
|
+
* <ngt-point-light
|
|
244
|
+
* [sync]="light"
|
|
245
|
+
* [syncProps]="[
|
|
246
|
+
* ['intensity', { label: 'Light Intensity', key: 'lightIntensity' }],
|
|
247
|
+
* 'color'
|
|
248
|
+
* ]"
|
|
249
|
+
* #light
|
|
250
|
+
* />
|
|
251
|
+
* </ng-template>
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @typeParam TObject - The type of the Three.js object being synchronized
|
|
255
|
+
*/
|
|
72
256
|
declare class TheatreSheetObjectSync<TObject extends object> {
|
|
257
|
+
/**
|
|
258
|
+
* The Three.js object to synchronize with Theatre.js.
|
|
259
|
+
* Can be an object reference, ElementRef, or a function returning either.
|
|
260
|
+
*/
|
|
73
261
|
parent: _angular_core.InputSignal<TObject | ElementRef<TObject> | (() => TObject | ElementRef<TObject> | undefined | null)>;
|
|
262
|
+
/**
|
|
263
|
+
* Array of property paths to synchronize with Theatre.js.
|
|
264
|
+
*
|
|
265
|
+
* Each item can be:
|
|
266
|
+
* - A string property path (e.g., 'opacity', 'position.x')
|
|
267
|
+
* - A tuple of [propertyPath, keyOrOptions] where options can include:
|
|
268
|
+
* - `label`: Display label in Theatre.js Studio
|
|
269
|
+
* - `key`: Unique key for the property in Theatre.js
|
|
270
|
+
* - `transformer`: Custom transformer for the property value
|
|
271
|
+
*
|
|
272
|
+
* @default []
|
|
273
|
+
*/
|
|
74
274
|
props: _angular_core.InputSignal<(string | [string, string | {
|
|
75
275
|
label?: string;
|
|
76
276
|
key?: string;
|
|
77
277
|
transformer?: TheatreTransformer;
|
|
78
278
|
}])[]>;
|
|
79
279
|
private theatreSheetObject;
|
|
280
|
+
/**
|
|
281
|
+
* Computed signal containing the Theatre.js sheet object instance.
|
|
282
|
+
*/
|
|
80
283
|
sheetObject: _angular_core.Signal<_theatre_core.ISheetObject<_theatre_core.UnknownShorthandCompoundProps>>;
|
|
81
284
|
private studio;
|
|
82
285
|
private parentRef;
|
|
@@ -84,19 +287,85 @@ declare class TheatreSheetObjectSync<TObject extends object> {
|
|
|
84
287
|
private propsToAdd;
|
|
85
288
|
private propsMapping;
|
|
86
289
|
constructor();
|
|
290
|
+
/**
|
|
291
|
+
* Captures the current values of all synchronized properties from the Three.js object
|
|
292
|
+
* and commits them to Theatre.js.
|
|
293
|
+
*
|
|
294
|
+
* This is useful for "baking" the current state of the Three.js object into the
|
|
295
|
+
* Theatre.js animation. Requires Theatre.js Studio to be available.
|
|
296
|
+
*/
|
|
87
297
|
capture(): void;
|
|
298
|
+
/**
|
|
299
|
+
* Converts a property path (e.g., 'position.x') to a safe alphanumeric key.
|
|
300
|
+
*
|
|
301
|
+
* @param propPath - The property path to convert
|
|
302
|
+
* @returns A safe alphanumeric key string
|
|
303
|
+
*/
|
|
88
304
|
private resolvePropertyPath;
|
|
89
305
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheatreSheetObjectSync<any>, never>;
|
|
90
306
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TheatreSheetObjectSync<any>, "[sync]", ["sync"], { "parent": { "alias": "sync"; "required": true; "isSignal": true; }; "props": { "alias": "syncProps"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
91
307
|
}
|
|
92
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Component that provides transform controls for animating position, rotation, and scale
|
|
311
|
+
* of child Three.js objects via Theatre.js.
|
|
312
|
+
*
|
|
313
|
+
* When the sheet object is selected in Theatre.js Studio, transform controls appear
|
|
314
|
+
* allowing direct manipulation of the object's transform. Changes are captured and
|
|
315
|
+
* committed to Theatre.js.
|
|
316
|
+
*
|
|
317
|
+
* Must be used within a `TheatreSheetObject` context.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```html
|
|
321
|
+
* <ng-template sheetObject="myCube">
|
|
322
|
+
* <theatre-transform>
|
|
323
|
+
* <ngt-mesh>
|
|
324
|
+
* <ngt-box-geometry />
|
|
325
|
+
* <ngt-mesh-standard-material />
|
|
326
|
+
* </ngt-mesh>
|
|
327
|
+
* </theatre-transform>
|
|
328
|
+
* </ng-template>
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```html
|
|
333
|
+
* <!-- With custom key and options -->
|
|
334
|
+
* <ng-template sheetObject="scene">
|
|
335
|
+
* <theatre-transform key="cubeTransform" label="Cube" [options]="{ mode: 'rotate' }">
|
|
336
|
+
* <ngt-mesh />
|
|
337
|
+
* </theatre-transform>
|
|
338
|
+
* </ng-template>
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* @typeParam TLabel - The type of the label string
|
|
342
|
+
*/
|
|
93
343
|
declare class TheatreSheetObjectTransform<TLabel extends string | undefined> {
|
|
344
|
+
/**
|
|
345
|
+
* Display label for the transform properties in Theatre.js Studio.
|
|
346
|
+
*/
|
|
94
347
|
label: _angular_core.InputSignal<TLabel | undefined>;
|
|
348
|
+
/**
|
|
349
|
+
* Unique key for grouping the transform properties in Theatre.js.
|
|
350
|
+
* If provided, position/rotation/scale will be nested under this key.
|
|
351
|
+
*/
|
|
95
352
|
key: _angular_core.InputSignal<string | undefined>;
|
|
353
|
+
/**
|
|
354
|
+
* Options for the transform controls gizmo.
|
|
355
|
+
* Allows configuring the transform mode, snap values, and coordinate space.
|
|
356
|
+
*
|
|
357
|
+
* @default {}
|
|
358
|
+
*/
|
|
96
359
|
options: _angular_core.InputSignal<Pick<NgtsTransformControlsOptions, "mode" | "translationSnap" | "scaleSnap" | "rotationSnap" | "space">>;
|
|
360
|
+
/**
|
|
361
|
+
* Reference to the Three.js Group element that wraps the transformed content.
|
|
362
|
+
*/
|
|
97
363
|
groupRef: _angular_core.Signal<ElementRef<THREE.Group<THREE.Object3DEventMap>>>;
|
|
98
364
|
private controlsRef;
|
|
99
365
|
private theatreSheetObject;
|
|
366
|
+
/**
|
|
367
|
+
* Computed signal containing the Theatre.js sheet object instance.
|
|
368
|
+
*/
|
|
100
369
|
sheetObject: _angular_core.Signal<_theatre_core.ISheetObject<_theatre_core.UnknownShorthandCompoundProps>>;
|
|
101
370
|
private studio;
|
|
102
371
|
protected selected: _angular_core.Signal<boolean>;
|
|
@@ -113,17 +382,86 @@ declare class TheatreSheetObjectTransform<TLabel extends string | undefined> {
|
|
|
113
382
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TheatreSheetObjectTransform<any>, "theatre-transform", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "key": { "alias": "key"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
114
383
|
}
|
|
115
384
|
|
|
116
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Combined array of sheet object directives for convenient importing.
|
|
387
|
+
*
|
|
388
|
+
* Includes:
|
|
389
|
+
* - `TheatreSheetObject` - Base directive for creating sheet objects
|
|
390
|
+
* - `TheatreSheetObjectTransform` - Component for animating transform properties
|
|
391
|
+
* - `TheatreSheetObjectSync` - Directive for syncing arbitrary object properties
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* import { TheatreSheetObject } from 'angular-three-theatre';
|
|
396
|
+
*
|
|
397
|
+
* @Component({
|
|
398
|
+
* imports: [TheatreSheetObject],
|
|
399
|
+
* template: `
|
|
400
|
+
* <ng-template sheetObject="myObject">
|
|
401
|
+
* <theatre-transform>
|
|
402
|
+
* <ngt-mesh />
|
|
403
|
+
* </theatre-transform>
|
|
404
|
+
* </ng-template>
|
|
405
|
+
* `
|
|
406
|
+
* })
|
|
407
|
+
* export class MyComponent {}
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
declare const TheatreSheetObject: (typeof TheatreSheetObject$1 | typeof TheatreSheetObjectTransform | typeof TheatreSheetObjectSync)[];
|
|
117
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Directive that initializes and manages the Theatre.js Studio.
|
|
414
|
+
*
|
|
415
|
+
* Theatre.js Studio is a visual editor that allows you to create and edit
|
|
416
|
+
* animations directly in the browser. The studio UI is dynamically imported
|
|
417
|
+
* to avoid including it in production builds.
|
|
418
|
+
*
|
|
419
|
+
* This directive must be applied to a `theatre-project` element and provides
|
|
420
|
+
* the studio instance via the `THEATRE_STUDIO` injection token.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```html
|
|
424
|
+
* <!-- Enable studio (default) -->
|
|
425
|
+
* <theatre-project studio>
|
|
426
|
+
* <ng-container sheet="scene">...</ng-container>
|
|
427
|
+
* </theatre-project>
|
|
428
|
+
*
|
|
429
|
+
* <!-- Conditionally enable/disable studio -->
|
|
430
|
+
* <theatre-project [studio]="isDevelopment">
|
|
431
|
+
* <ng-container sheet="scene">...</ng-container>
|
|
432
|
+
* </theatre-project>
|
|
433
|
+
*
|
|
434
|
+
* <!-- Disable studio -->
|
|
435
|
+
* <theatre-project [studio]="false">
|
|
436
|
+
* <ng-container sheet="scene">...</ng-container>
|
|
437
|
+
* </theatre-project>
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
118
440
|
declare class TheatreStudio {
|
|
441
|
+
/**
|
|
442
|
+
* Whether the studio UI should be visible.
|
|
443
|
+
* When false, the studio UI is hidden but the studio instance remains active.
|
|
444
|
+
*
|
|
445
|
+
* @default true
|
|
446
|
+
*/
|
|
119
447
|
enabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
120
448
|
private Studio;
|
|
449
|
+
/**
|
|
450
|
+
* Read-only signal containing the Theatre.js Studio instance.
|
|
451
|
+
* May be null while the studio is being loaded.
|
|
452
|
+
*/
|
|
121
453
|
studio: _angular_core.Signal<IStudio | null>;
|
|
122
454
|
constructor();
|
|
123
455
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheatreStudio, never>;
|
|
124
456
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TheatreStudio, "theatre-project[studio]", ["studio"], { "enabled": { "alias": "studio"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
125
457
|
}
|
|
126
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Options for attaching audio to a Theatre.js sequence.
|
|
461
|
+
*
|
|
462
|
+
* When audio is attached, the sequence playback will be synchronized
|
|
463
|
+
* with the audio playback.
|
|
464
|
+
*/
|
|
127
465
|
interface AttachAudioOptions {
|
|
128
466
|
/**
|
|
129
467
|
* Either a URL to the audio file (eg "http://localhost:3000/audio.mp3") or an instance of AudioBuffer
|
|
@@ -138,39 +476,152 @@ interface AttachAudioOptions {
|
|
|
138
476
|
*/
|
|
139
477
|
destinationNode?: AudioNode;
|
|
140
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Configuration options for the TheatreSequence directive.
|
|
481
|
+
*
|
|
482
|
+
* Extends Theatre.js sequence play options with additional Angular-specific options
|
|
483
|
+
* for automatic playback control.
|
|
484
|
+
*/
|
|
141
485
|
type TheatreSequenceOptions = Parameters<ISequence['play']>[0] & {
|
|
486
|
+
/**
|
|
487
|
+
* Whether to automatically start playback when the sequence is initialized.
|
|
488
|
+
* @default false
|
|
489
|
+
*/
|
|
142
490
|
autoplay: boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Whether to automatically pause playback when the directive is destroyed.
|
|
493
|
+
* @default false
|
|
494
|
+
*/
|
|
143
495
|
autopause: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Delay in milliseconds before autoplay starts.
|
|
498
|
+
* @default 0
|
|
499
|
+
*/
|
|
144
500
|
delay: number;
|
|
501
|
+
/**
|
|
502
|
+
* When to reset the sequence position to 0.
|
|
503
|
+
* - 'init': Reset when the directive is initialized
|
|
504
|
+
* - 'destroy': Reset when the directive is destroyed
|
|
505
|
+
* - 'always': Reset on both init and destroy
|
|
506
|
+
*/
|
|
145
507
|
autoreset?: 'init' | 'destroy' | 'always';
|
|
146
508
|
};
|
|
509
|
+
/**
|
|
510
|
+
* Directive that provides control over a Theatre.js sequence.
|
|
511
|
+
*
|
|
512
|
+
* A sequence controls the playback of animations within a sheet. This directive
|
|
513
|
+
* provides methods to play, pause, and reset the sequence, as well as reactive
|
|
514
|
+
* signals for the current position, playing state, and length.
|
|
515
|
+
*
|
|
516
|
+
* Must be used on an element that also has the `sheet` directive.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```html
|
|
520
|
+
* <ng-container sheet="scene" [sequence]="{ autoplay: true, rate: 1 }" #seq="sequence">
|
|
521
|
+
* <p>Position: {{ seq.position() }}</p>
|
|
522
|
+
* <button (click)="seq.play()">Play</button>
|
|
523
|
+
* <button (click)="seq.pause()">Pause</button>
|
|
524
|
+
* </ng-container>
|
|
525
|
+
* ```
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```html
|
|
529
|
+
* <!-- With audio synchronization -->
|
|
530
|
+
* <ng-container
|
|
531
|
+
* sheet="scene"
|
|
532
|
+
* [sequence]="{ autoplay: true }"
|
|
533
|
+
* [sequenceAudio]="{ source: '/audio/soundtrack.mp3' }"
|
|
534
|
+
* />
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
147
537
|
declare class TheatreSequence {
|
|
538
|
+
/**
|
|
539
|
+
* Sequence configuration options.
|
|
540
|
+
* Merged with default options using ngxtension's mergeInputs.
|
|
541
|
+
*
|
|
542
|
+
* @default { rate: 1, autoplay: false, autopause: false, delay: 0 }
|
|
543
|
+
*/
|
|
148
544
|
options: _angular_core.InputSignalWithTransform<{
|
|
149
545
|
iterationCount?: number;
|
|
150
546
|
range?: [from: number, to: number];
|
|
151
547
|
rate?: number;
|
|
152
|
-
direction?: "
|
|
548
|
+
direction?: "normal" | "reverse" | "alternate" | "alternateReverse";
|
|
153
549
|
rafDriver?: _theatre_core.IRafDriver;
|
|
154
550
|
} & {
|
|
551
|
+
/**
|
|
552
|
+
* Whether to automatically start playback when the sequence is initialized.
|
|
553
|
+
* @default false
|
|
554
|
+
*/
|
|
155
555
|
autoplay: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Whether to automatically pause playback when the directive is destroyed.
|
|
558
|
+
* @default false
|
|
559
|
+
*/
|
|
156
560
|
autopause: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Delay in milliseconds before autoplay starts.
|
|
563
|
+
* @default 0
|
|
564
|
+
*/
|
|
157
565
|
delay: number;
|
|
566
|
+
/**
|
|
567
|
+
* When to reset the sequence position to 0.
|
|
568
|
+
* - 'init': Reset when the directive is initialized
|
|
569
|
+
* - 'destroy': Reset when the directive is destroyed
|
|
570
|
+
* - 'always': Reset on both init and destroy
|
|
571
|
+
*/
|
|
158
572
|
autoreset?: "init" | "destroy" | "always";
|
|
159
573
|
}, "" | Partial<{
|
|
160
574
|
iterationCount?: number;
|
|
161
575
|
range?: [from: number, to: number];
|
|
162
576
|
rate?: number;
|
|
163
|
-
direction?: "
|
|
577
|
+
direction?: "normal" | "reverse" | "alternate" | "alternateReverse";
|
|
164
578
|
rafDriver?: _theatre_core.IRafDriver;
|
|
165
579
|
} & {
|
|
580
|
+
/**
|
|
581
|
+
* Whether to automatically start playback when the sequence is initialized.
|
|
582
|
+
* @default false
|
|
583
|
+
*/
|
|
166
584
|
autoplay: boolean;
|
|
585
|
+
/**
|
|
586
|
+
* Whether to automatically pause playback when the directive is destroyed.
|
|
587
|
+
* @default false
|
|
588
|
+
*/
|
|
167
589
|
autopause: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Delay in milliseconds before autoplay starts.
|
|
592
|
+
* @default 0
|
|
593
|
+
*/
|
|
168
594
|
delay: number;
|
|
595
|
+
/**
|
|
596
|
+
* When to reset the sequence position to 0.
|
|
597
|
+
* - 'init': Reset when the directive is initialized
|
|
598
|
+
* - 'destroy': Reset when the directive is destroyed
|
|
599
|
+
* - 'always': Reset on both init and destroy
|
|
600
|
+
*/
|
|
169
601
|
autoreset?: "init" | "destroy" | "always";
|
|
170
602
|
}>>;
|
|
603
|
+
/**
|
|
604
|
+
* Audio options for synchronizing playback with an audio file.
|
|
605
|
+
* When provided, the sequence will be synchronized with the audio.
|
|
606
|
+
*/
|
|
171
607
|
audioOptions: _angular_core.InputSignal<AttachAudioOptions | undefined>;
|
|
608
|
+
/**
|
|
609
|
+
* Two-way bindable signal for the current playback position in seconds.
|
|
610
|
+
*
|
|
611
|
+
* @default 0
|
|
612
|
+
*/
|
|
172
613
|
position: _angular_core.ModelSignal<number>;
|
|
614
|
+
/**
|
|
615
|
+
* Two-way bindable signal indicating whether the sequence is currently playing.
|
|
616
|
+
*
|
|
617
|
+
* @default false
|
|
618
|
+
*/
|
|
173
619
|
playing: _angular_core.ModelSignal<boolean>;
|
|
620
|
+
/**
|
|
621
|
+
* Two-way bindable signal for the total length of the sequence in seconds.
|
|
622
|
+
*
|
|
623
|
+
* @default 0
|
|
624
|
+
*/
|
|
174
625
|
length: _angular_core.ModelSignal<number>;
|
|
175
626
|
private playOptions;
|
|
176
627
|
private autoplay;
|
|
@@ -179,24 +630,104 @@ declare class TheatreSequence {
|
|
|
179
630
|
private delay;
|
|
180
631
|
private project;
|
|
181
632
|
private sheet;
|
|
633
|
+
/**
|
|
634
|
+
* Computed signal containing the Theatre.js sequence instance.
|
|
635
|
+
*/
|
|
182
636
|
sequence: _angular_core.Signal<ISequence>;
|
|
183
637
|
constructor();
|
|
638
|
+
/**
|
|
639
|
+
* Pauses the sequence playback at the current position.
|
|
640
|
+
*/
|
|
184
641
|
pause(): void;
|
|
642
|
+
/**
|
|
643
|
+
* Starts or resumes sequence playback.
|
|
644
|
+
*
|
|
645
|
+
* Waits for the project to be ready before starting playback.
|
|
646
|
+
* Options are merged with the configured play options.
|
|
647
|
+
*
|
|
648
|
+
* @param options - Optional play options that override the configured options
|
|
649
|
+
*/
|
|
185
650
|
play(options?: Parameters<ISequence['play']>[0]): void;
|
|
651
|
+
/**
|
|
652
|
+
* Resets the sequence position to 0.
|
|
653
|
+
*
|
|
654
|
+
* If the sequence was playing before reset, it will continue playing
|
|
655
|
+
* from the beginning.
|
|
656
|
+
*/
|
|
186
657
|
reset(): void;
|
|
187
658
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheatreSequence, never>;
|
|
188
659
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TheatreSequence, "[sheet][sequence]", ["sequence"], { "options": { "alias": "sequence"; "required": false; "isSignal": true; }; "audioOptions": { "alias": "sequenceAudio"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "playing": { "alias": "playing"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": false; "isSignal": true; }; }, { "position": "positionChange"; "playing": "playingChange"; "length": "lengthChange"; }, never, never, true, never>;
|
|
189
660
|
}
|
|
190
661
|
|
|
662
|
+
/**
|
|
663
|
+
* Directive that creates and manages a Theatre.js sheet within a project.
|
|
664
|
+
*
|
|
665
|
+
* A sheet is a container for sheet objects and their animations. Multiple sheets
|
|
666
|
+
* can exist within a project, allowing you to organize animations into logical groups.
|
|
667
|
+
*
|
|
668
|
+
* The directive automatically handles reference counting and cleanup when the
|
|
669
|
+
* directive is destroyed.
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```html
|
|
673
|
+
* <theatre-project>
|
|
674
|
+
* <ng-container sheet="mainScene">
|
|
675
|
+
* <!-- sheet objects here -->
|
|
676
|
+
* </ng-container>
|
|
677
|
+
* </theatre-project>
|
|
678
|
+
* ```
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```html
|
|
682
|
+
* <!-- Using with template reference -->
|
|
683
|
+
* <ng-container sheet="mySheet" #sheetRef="sheet">
|
|
684
|
+
* {{ sheetRef.sheet().sequence.position }}
|
|
685
|
+
* </ng-container>
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
191
688
|
declare class TheatreSheet$1 {
|
|
689
|
+
/**
|
|
690
|
+
* The name of the sheet within the project.
|
|
691
|
+
* This name must be unique within the parent project.
|
|
692
|
+
*
|
|
693
|
+
* @default 'default-theatre-sheet'
|
|
694
|
+
*/
|
|
192
695
|
name: _angular_core.InputSignalWithTransform<string, string>;
|
|
193
696
|
private project;
|
|
697
|
+
/**
|
|
698
|
+
* Computed signal containing the Theatre.js sheet instance.
|
|
699
|
+
* Returns an existing sheet if one with the same name already exists,
|
|
700
|
+
* otherwise creates a new sheet.
|
|
701
|
+
*/
|
|
194
702
|
sheet: _angular_core.Signal<_theatre_core.ISheet>;
|
|
195
703
|
constructor();
|
|
196
704
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheatreSheet$1, never>;
|
|
197
705
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TheatreSheet$1, "[sheet]", ["sheet"], { "name": { "alias": "sheet"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
198
706
|
}
|
|
199
707
|
|
|
708
|
+
/**
|
|
709
|
+
* Angular Three Theatre.js integration library
|
|
710
|
+
*
|
|
711
|
+
* This library provides Angular components and directives for integrating
|
|
712
|
+
* Theatre.js animation toolkit with Angular Three applications.
|
|
713
|
+
*
|
|
714
|
+
* @packageDocumentation
|
|
715
|
+
*/
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Combined array of TheatreSheet and TheatreSequence directives for convenient importing.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```typescript
|
|
722
|
+
* import { TheatreSheet } from 'angular-three-theatre';
|
|
723
|
+
*
|
|
724
|
+
* @Component({
|
|
725
|
+
* imports: [TheatreSheet],
|
|
726
|
+
* template: `<ng-container sheet="mySheet" sequence />`
|
|
727
|
+
* })
|
|
728
|
+
* export class MyComponent {}
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
200
731
|
declare const TheatreSheet: readonly [typeof TheatreSheet$1, typeof TheatreSequence];
|
|
201
732
|
|
|
202
733
|
export { TheatreProject, TheatreSequence, TheatreSheet, TheatreSheet$1 as TheatreSheetImpl, TheatreSheetObject, TheatreSheetObject$1 as TheatreSheetObjectImpl, TheatreSheetObjectSync, TheatreSheetObjectTransform, TheatreStudio };
|