@cesdk/engine 1.56.0-nightly.20250706 → 1.56.0-nightly.20250708
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/assets/core/{cesdk-v1.56.0-nightly.20250706-F7XGIFMI.wasm → cesdk-v1.56.0-nightly.20250708-GBDVLO4A.wasm} +0 -0
- package/assets/core/worker-host-v1.56.0-nightly.20250708.js +1 -0
- package/index.d.ts +864 -9
- package/index.js +1 -1
- package/package.json +1 -1
- package/assets/core/worker-host-v1.56.0-nightly.20250706.js +0 -1
- /package/assets/core/{cesdk-v1.56.0-nightly.20250706-44YCFRT6.data → cesdk-v1.56.0-nightly.20250708-44YCFRT6.data} +0 -0
package/index.d.ts
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for adding images to the scene.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare type AddImageOptions = {
|
|
6
|
+
/** How the image should be sized and positioned */
|
|
7
|
+
sizeMode?: SizeMode;
|
|
8
|
+
/** How the position should be interpreted */
|
|
9
|
+
positionMode?: PositionMode;
|
|
10
|
+
/** X position in scene design units */
|
|
11
|
+
x?: number;
|
|
12
|
+
/** Y position in scene design units */
|
|
13
|
+
y?: number;
|
|
14
|
+
/** Corner radius for rounded corners in scene design units */
|
|
15
|
+
cornerRadius?: number;
|
|
16
|
+
/** Size for the image - can be a number for equal width/height or an object */
|
|
17
|
+
size?: number | {
|
|
18
|
+
/** Width in scene design units */
|
|
19
|
+
width: number;
|
|
20
|
+
/** Height in scene design units */
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
/** Timeline configuration for video scenes */
|
|
24
|
+
timeline?: {
|
|
25
|
+
/** Start time offset in seconds */
|
|
26
|
+
timeOffset?: number;
|
|
27
|
+
/** Duration in seconds */
|
|
28
|
+
duration?: number;
|
|
29
|
+
};
|
|
30
|
+
/** Drop shadow configuration */
|
|
31
|
+
shadow?: DropShadowOptions;
|
|
32
|
+
/** Animation configuration */
|
|
33
|
+
animation?: AnimationOptions;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Options for adding videos to the scene.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare interface AddVideoOptions {
|
|
41
|
+
/** How the video should be sized and positioned */
|
|
42
|
+
sizeMode?: SizeMode;
|
|
43
|
+
/** How the position should be interpreted */
|
|
44
|
+
positionMode?: PositionMode;
|
|
45
|
+
/** X position in scene design units */
|
|
46
|
+
x?: number;
|
|
47
|
+
/** Y position in scene design units */
|
|
48
|
+
y?: number;
|
|
49
|
+
/** Corner radius for rounded corners in scene design units */
|
|
50
|
+
cornerRadius?: number;
|
|
51
|
+
/** Timeline configuration */
|
|
52
|
+
timeline?: {
|
|
53
|
+
/** Start time offset in seconds */
|
|
54
|
+
timeOffset?: number;
|
|
55
|
+
/** Duration in seconds */
|
|
56
|
+
duration?: number;
|
|
57
|
+
};
|
|
58
|
+
/** Drop shadow configuration */
|
|
59
|
+
shadow?: DropShadowOptions;
|
|
60
|
+
/** Animation configuration */
|
|
61
|
+
animation?: AnimationOptions;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The easing options for the camera animation.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare type AnimationEasing = 'Linear' | 'EaseIn' | 'EaseOut' | 'EaseInOut' | 'EaseInQuart' | 'EaseOutQuart' | 'EaseInOutQuart' | 'EaseInQuint' | 'EaseOutQuint' | 'EaseInOutQuint' | 'EaseInBack' | 'EaseOutBack' | 'EaseInOutBack' | 'EaseInSpring' | 'EaseOutSpring' | 'EaseInOutSpring';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Configuration options for animations.
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare type AnimationEntry = {
|
|
75
|
+
/** The type of animation to apply */
|
|
76
|
+
type: AnimationType;
|
|
77
|
+
/** Duration of the animation in seconds */
|
|
78
|
+
duration: number;
|
|
79
|
+
/** Easing function for the animation */
|
|
80
|
+
easing?: AnimationEasing;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Options for configuring animations (in, loop, out animations).
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare type AnimationOptions = {
|
|
88
|
+
/** Animation when the element enters */
|
|
89
|
+
in?: AnimationEntry;
|
|
90
|
+
/** Animation that loops while the element is visible */
|
|
91
|
+
loop?: AnimationEntry;
|
|
92
|
+
/** Animation when the element exits */
|
|
93
|
+
out?: AnimationEntry;
|
|
94
|
+
};
|
|
95
|
+
|
|
1
96
|
/**
|
|
2
97
|
* The block type IDs for the animation blocks. These are the IDs used to create new animations
|
|
3
98
|
* using `cesdk.engine.block.createAnimation(id)`.
|
|
@@ -122,6 +217,27 @@ export declare class AssetAPI {
|
|
|
122
217
|
* The asset source provides methods for finding assets, applying them to scenes or blocks,
|
|
123
218
|
* and managing asset lifecycle. All source operations are handled asynchronously.
|
|
124
219
|
*
|
|
220
|
+
* ```javascript
|
|
221
|
+
* engine.asset.addSource({
|
|
222
|
+
* id: 'foobar',
|
|
223
|
+
* async findAssets(queryData) {
|
|
224
|
+
* return Promise.resolve({
|
|
225
|
+
* assets: [
|
|
226
|
+
* {
|
|
227
|
+
* id: 'logo',
|
|
228
|
+
* meta: {
|
|
229
|
+
* uri: 'https://img.ly/static/ubq_samples/imgly_logo.jpg',
|
|
230
|
+
* }
|
|
231
|
+
* }
|
|
232
|
+
* ],
|
|
233
|
+
* total: 1,
|
|
234
|
+
* currentPage: queryData.page,
|
|
235
|
+
* nextPage: undefined
|
|
236
|
+
* });
|
|
237
|
+
* },
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
125
241
|
* @category Asset Source Management
|
|
126
242
|
* @param source - The asset source configuration.
|
|
127
243
|
*/
|
|
@@ -132,6 +248,10 @@ export declare class AssetAPI {
|
|
|
132
248
|
* Local asset sources allow dynamic asset management through the add/remove methods.
|
|
133
249
|
* You can specify supported MIME types to restrict what assets can be added.
|
|
134
250
|
*
|
|
251
|
+
* ```javascript
|
|
252
|
+
* engine.asset.addLocalSource('local-source');
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
135
255
|
* @category Asset Source Management
|
|
136
256
|
* @param id - Unique identifier for the asset source.
|
|
137
257
|
* @param supportedMimeTypes - The mime types of assets that are allowed to be added to this local source.
|
|
@@ -145,6 +265,10 @@ export declare class AssetAPI {
|
|
|
145
265
|
* This permanently removes the asset source and all its associated assets.
|
|
146
266
|
* Any ongoing operations with this source will be cancelled.
|
|
147
267
|
*
|
|
268
|
+
* ```javascript
|
|
269
|
+
* engine.asset.removeSource('asset-source-id');
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
148
272
|
* @category Asset Source Management
|
|
149
273
|
* @param id - The ID of the asset source to remove.
|
|
150
274
|
*/
|
|
@@ -152,6 +276,10 @@ export declare class AssetAPI {
|
|
|
152
276
|
/**
|
|
153
277
|
* Get all registered asset source IDs.
|
|
154
278
|
*
|
|
279
|
+
* ```javascript
|
|
280
|
+
* engine.asset.findAllSources();
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
155
283
|
* @category Asset Source Management
|
|
156
284
|
* @returns A list with the IDs of all registered asset sources.
|
|
157
285
|
*/
|
|
@@ -162,6 +290,14 @@ export declare class AssetAPI {
|
|
|
162
290
|
* Supports pagination, text search, tag filtering, grouping, and sorting options.
|
|
163
291
|
* Results include asset metadata, thumbnails, and application context.
|
|
164
292
|
*
|
|
293
|
+
* ```javascript
|
|
294
|
+
* const result = await engine.asset.findAssets('asset-source-id', {
|
|
295
|
+
* page: 0,
|
|
296
|
+
* perPage: 100
|
|
297
|
+
* });
|
|
298
|
+
* const asset = result.assets[0];
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
165
301
|
* @category Asset Discovery
|
|
166
302
|
* @param sourceId - The ID of the asset source.
|
|
167
303
|
* @param query - Query options to filter and sort the search results.
|
|
@@ -173,6 +309,10 @@ export declare class AssetAPI {
|
|
|
173
309
|
*
|
|
174
310
|
* Groups provide categorization for assets within a source, enabling filtered discovery.
|
|
175
311
|
*
|
|
312
|
+
* ```javascript
|
|
313
|
+
* const groups = engine.asset.getGroups(customSource.id);
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
176
316
|
* @category Asset Information
|
|
177
317
|
* @param id - The ID of the asset source.
|
|
178
318
|
* @returns Promise resolving to list of available group names.
|
|
@@ -183,6 +323,10 @@ export declare class AssetAPI {
|
|
|
183
323
|
*
|
|
184
324
|
* Returns the file types that can be added to this source. An empty result means all MIME types are supported.
|
|
185
325
|
*
|
|
326
|
+
* ```javascript
|
|
327
|
+
* const mimeTypes = engine.asset.getSupportedMimeTypes('asset-source-id');
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
186
330
|
* @category Asset Information
|
|
187
331
|
* @param sourceId - The ID of the asset source.
|
|
188
332
|
* @returns Array of supported MIME type strings.
|
|
@@ -191,6 +335,10 @@ export declare class AssetAPI {
|
|
|
191
335
|
/**
|
|
192
336
|
* Get attribution credits for an asset source.
|
|
193
337
|
*
|
|
338
|
+
* ```javascript
|
|
339
|
+
* const credits = engine.asset.getCredits('asset-source-id');
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
194
342
|
* @category Asset Information
|
|
195
343
|
* @param sourceId - The ID of the asset source.
|
|
196
344
|
* @returns The asset source's credits info consisting of a name and an optional URL.
|
|
@@ -202,6 +350,10 @@ export declare class AssetAPI {
|
|
|
202
350
|
/**
|
|
203
351
|
* Get license information for an asset source.
|
|
204
352
|
*
|
|
353
|
+
* ```javascript
|
|
354
|
+
* const license = engine.asset.getLicense('asset-source-id');
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
205
357
|
* @category Asset Information
|
|
206
358
|
* @param sourceId - The ID of the asset source.
|
|
207
359
|
* @returns The asset source's license info consisting of a name and an optional URL.
|
|
@@ -213,9 +365,13 @@ export declare class AssetAPI {
|
|
|
213
365
|
/**
|
|
214
366
|
* Check if an asset source supports asset management.
|
|
215
367
|
*
|
|
216
|
-
* Returns true if the source allows adding and removing assets dynamically.
|
|
368
|
+
* Returns true if the source allows adding and removing assets dynamically, via 'Add File' and 'Delete' button on the UI.
|
|
217
369
|
* This is typically true for local asset sources and false for remote sources.
|
|
218
370
|
*
|
|
371
|
+
* ```javascript
|
|
372
|
+
* engine.asset.canManageAssets('asset-source-id');
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
219
375
|
* @category Asset Information
|
|
220
376
|
* @param sourceId - The ID of the asset source to check.
|
|
221
377
|
* @returns True if the source supports asset management operations.
|
|
@@ -227,6 +383,19 @@ export declare class AssetAPI {
|
|
|
227
383
|
* Only works with local asset sources that support asset management.
|
|
228
384
|
* The asset will be validated against the source's supported MIME types.
|
|
229
385
|
*
|
|
386
|
+
* ```javascript
|
|
387
|
+
* engine.asset.addAssetToSource('local-source', {
|
|
388
|
+
* id: 'asset-id',
|
|
389
|
+
* label: {
|
|
390
|
+
* en: 'My Asset'
|
|
391
|
+
* },
|
|
392
|
+
* meta: {
|
|
393
|
+
* uri: 'https://example.com/asset.jpg',
|
|
394
|
+
* mimeType: 'image/jpeg'
|
|
395
|
+
* }
|
|
396
|
+
* });
|
|
397
|
+
* ```
|
|
398
|
+
*
|
|
230
399
|
* @category Asset Lifecycle
|
|
231
400
|
* @param sourceId - The local asset source ID that the asset should be added to.
|
|
232
401
|
* @param asset - The asset definition to add to the source.
|
|
@@ -238,6 +407,10 @@ export declare class AssetAPI {
|
|
|
238
407
|
* Only works with local asset sources that support asset management.
|
|
239
408
|
* The asset will be permanently deleted from the source.
|
|
240
409
|
*
|
|
410
|
+
* ```javascript
|
|
411
|
+
* engine.asset.removeAssetFromSource('local-source', 'asset-id');
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
241
414
|
* @category Asset Lifecycle
|
|
242
415
|
* @param sourceId - The id of the local asset source that currently contains the asset.
|
|
243
416
|
* @param assetId - The id of the asset to be removed.
|
|
@@ -249,6 +422,10 @@ export declare class AssetAPI {
|
|
|
249
422
|
* Creates a new block configured according to the asset's properties and adds it to the scene.
|
|
250
423
|
* The behavior can be customized by providing an `applyAsset` function when registering the asset source.
|
|
251
424
|
*
|
|
425
|
+
* ```javascript
|
|
426
|
+
* await engine.asset.apply('asset-source-id', assetResult.assets[0]);
|
|
427
|
+
* ```
|
|
428
|
+
*
|
|
252
429
|
* @category Asset Application
|
|
253
430
|
* @param sourceId - The ID of the asset source.
|
|
254
431
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
@@ -261,6 +438,10 @@ export declare class AssetAPI {
|
|
|
261
438
|
* Modifies the target block's properties according to the asset's configuration.
|
|
262
439
|
* The behavior can be customized by providing an `applyAssetToBlock` function when registering the asset source.
|
|
263
440
|
*
|
|
441
|
+
* ```javascript
|
|
442
|
+
* await engine.asset.applyToBlock('asset-source-id', assetResult.assets[0]);
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
264
445
|
* @category Asset Application
|
|
265
446
|
* @param sourceId - The ID of the asset source.
|
|
266
447
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
@@ -273,6 +454,15 @@ export declare class AssetAPI {
|
|
|
273
454
|
* Allows applying individual properties (like colors, fonts, or effects) from an asset
|
|
274
455
|
* without creating a new block. The behavior can be customized by providing an `applyAssetProperty` function.
|
|
275
456
|
*
|
|
457
|
+
* ```javascript
|
|
458
|
+
* const asset = assetResult.assets[0];
|
|
459
|
+
* if (asset.payload && asset.payload.properties) {
|
|
460
|
+
* for (const property of asset.payload.properties) {
|
|
461
|
+
* await engine.asset.applyProperty('asset-source-id', asset, property);
|
|
462
|
+
* }
|
|
463
|
+
* }
|
|
464
|
+
* ```
|
|
465
|
+
*
|
|
276
466
|
* @category Asset Application
|
|
277
467
|
* @param sourceId - The ID of the asset source.
|
|
278
468
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
@@ -284,6 +474,30 @@ export declare class AssetAPI {
|
|
|
284
474
|
*
|
|
285
475
|
* The default implementation already handles various different kinds of assets and acts as a good starting point.
|
|
286
476
|
*
|
|
477
|
+
* ```javascript
|
|
478
|
+
* engine.asset.addSource({
|
|
479
|
+
* id: 'foobar',
|
|
480
|
+
* async findAssets(queryData) {
|
|
481
|
+
* return Promise.resolve({
|
|
482
|
+
* assets: [
|
|
483
|
+
* {
|
|
484
|
+
* id: 'logo',
|
|
485
|
+
* meta: {
|
|
486
|
+
* uri: 'https://img.ly/static/ubq_samples/imgly_logo.jpg',
|
|
487
|
+
* }
|
|
488
|
+
* }
|
|
489
|
+
* ],
|
|
490
|
+
* total: 1,
|
|
491
|
+
* currentPage: queryData.page,
|
|
492
|
+
* nextPage: undefined
|
|
493
|
+
* });
|
|
494
|
+
* },
|
|
495
|
+
* async applyAsset(assetResult) {
|
|
496
|
+
* return engine.asset.defaultApplyAsset(assetResult);
|
|
497
|
+
* },
|
|
498
|
+
* });
|
|
499
|
+
* ```
|
|
500
|
+
*
|
|
287
501
|
* @category Asset Application
|
|
288
502
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
289
503
|
* @returns Promise resolving to the created block ID, or undefined if no block was created.
|
|
@@ -294,6 +508,30 @@ export declare class AssetAPI {
|
|
|
294
508
|
*
|
|
295
509
|
* The default implementation already handles various different kinds of assets and acts as a good starting point.
|
|
296
510
|
*
|
|
511
|
+
* ```javascript
|
|
512
|
+
* engine.asset.addSource({
|
|
513
|
+
* id: 'foobar',
|
|
514
|
+
* async findAssets(queryData) {
|
|
515
|
+
* return Promise.resolve({
|
|
516
|
+
* assets: [
|
|
517
|
+
* {
|
|
518
|
+
* id: 'logo',
|
|
519
|
+
* meta: {
|
|
520
|
+
* uri: 'https://img.ly/static/ubq_samples/imgly_logo.jpg',
|
|
521
|
+
* }
|
|
522
|
+
* }
|
|
523
|
+
* ],
|
|
524
|
+
* total: 1,
|
|
525
|
+
* currentPage: queryData.page,
|
|
526
|
+
* nextPage: undefined
|
|
527
|
+
* });
|
|
528
|
+
* },
|
|
529
|
+
* async applyAssetToBlock(assetResult, block) {
|
|
530
|
+
* engine.asset.defaultApplyAssetToBlock(assetResult, block);
|
|
531
|
+
* },
|
|
532
|
+
* });
|
|
533
|
+
* ```
|
|
534
|
+
*
|
|
297
535
|
* @category Asset Application
|
|
298
536
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
299
537
|
* @param block - The block to apply the asset to.
|
|
@@ -302,6 +540,12 @@ export declare class AssetAPI {
|
|
|
302
540
|
/**
|
|
303
541
|
* Subscribe to asset source addition events.
|
|
304
542
|
*
|
|
543
|
+
* ```javascript
|
|
544
|
+
* engine.asset.onAssetSourceAdded((sourceID) => {
|
|
545
|
+
* console.log(`Added source: ${sourceID}`);
|
|
546
|
+
* });
|
|
547
|
+
* ```
|
|
548
|
+
*
|
|
305
549
|
* @category Event Subscriptions
|
|
306
550
|
* @param callback - The function called whenever an asset source is added.
|
|
307
551
|
* @returns A method to unsubscribe from the event.
|
|
@@ -310,6 +554,12 @@ export declare class AssetAPI {
|
|
|
310
554
|
/**
|
|
311
555
|
* Subscribe to asset source removal events.
|
|
312
556
|
*
|
|
557
|
+
* ```javascript
|
|
558
|
+
* engine.asset.onAssetSourceRemoved((sourceID) => {
|
|
559
|
+
* console.log(`Removed source: ${sourceID}`);
|
|
560
|
+
* });
|
|
561
|
+
* ```
|
|
562
|
+
*
|
|
313
563
|
* @category Event Subscriptions
|
|
314
564
|
* @param callback - The function called whenever an asset source is removed.
|
|
315
565
|
* @returns A method to unsubscribe from the event.
|
|
@@ -318,6 +568,12 @@ export declare class AssetAPI {
|
|
|
318
568
|
/**
|
|
319
569
|
* Subscribe to asset source content change events.
|
|
320
570
|
*
|
|
571
|
+
* ```javascript
|
|
572
|
+
* engine.asset.onAssetSourceUpdated((sourceID) => {
|
|
573
|
+
* console.log(`Updated source: ${sourceID}`);
|
|
574
|
+
* });
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
321
577
|
* @category Event Subscriptions
|
|
322
578
|
* @param callback - The function called whenever an asset source's contents are updated.
|
|
323
579
|
* @returns A method to unsubscribe from the event.
|
|
@@ -329,6 +585,10 @@ export declare class AssetAPI {
|
|
|
329
585
|
* This triggers refresh of any UI components that display assets from this source
|
|
330
586
|
* and notifies subscribers to the asset source update events.
|
|
331
587
|
*
|
|
588
|
+
* ```javascript
|
|
589
|
+
* engine.asset.assetSourceContentsChanged('asset-source-id');
|
|
590
|
+
* ```
|
|
591
|
+
*
|
|
332
592
|
* @category Asset Lifecycle
|
|
333
593
|
* @param sourceID - The asset source whose contents changed.
|
|
334
594
|
*/
|
|
@@ -1088,6 +1348,12 @@ export declare class BlockAPI {
|
|
|
1088
1348
|
/**
|
|
1089
1349
|
* Creates a new fill block.
|
|
1090
1350
|
*
|
|
1351
|
+
* ```javascript
|
|
1352
|
+
* const solidColoFill = engine.block.createFill('color');
|
|
1353
|
+
* // Longhand fill types are also supported
|
|
1354
|
+
* const imageFill = engine.block.createFill('//ly.img.ubq/fill/image');
|
|
1355
|
+
* ```
|
|
1356
|
+
*
|
|
1091
1357
|
* @category Block Fills
|
|
1092
1358
|
* @param type - The type of the fill object that shall be created.
|
|
1093
1359
|
* @returns The created fill's handle.
|
|
@@ -1112,13 +1378,21 @@ export declare class BlockAPI {
|
|
|
1112
1378
|
/**
|
|
1113
1379
|
* Gets the kind of a given block.
|
|
1114
1380
|
*
|
|
1381
|
+
* ```javascript
|
|
1382
|
+
* const kind = engine.block.getKind(block);
|
|
1383
|
+
* ```
|
|
1384
|
+
*
|
|
1115
1385
|
* @category Block Kind
|
|
1116
1386
|
* @param id - The block to query.
|
|
1117
1387
|
* @returns The block's kind.
|
|
1118
1388
|
*/
|
|
1119
1389
|
getKind(id: DesignBlockId): string;
|
|
1120
1390
|
/**
|
|
1121
|
-
* Sets the kind of a given block.
|
|
1391
|
+
* Sets the kind of a given block, a custom string for categorization of blocks.
|
|
1392
|
+
*
|
|
1393
|
+
* ```javascript
|
|
1394
|
+
* engine.block.setKind(text, 'title');
|
|
1395
|
+
* ```
|
|
1122
1396
|
*
|
|
1123
1397
|
* @category Block Kind
|
|
1124
1398
|
* @param id - The block whose kind should be changed.
|
|
@@ -1174,6 +1448,12 @@ export declare class BlockAPI {
|
|
|
1174
1448
|
/**
|
|
1175
1449
|
* Checks if a set of blocks can be grouped.
|
|
1176
1450
|
*
|
|
1451
|
+
* A scene block or a block that is already part of a group cannot be grouped.
|
|
1452
|
+
*
|
|
1453
|
+
* ```javascript
|
|
1454
|
+
* const groupable = engine.block.isGroupable([block1, block2])
|
|
1455
|
+
* ```
|
|
1456
|
+
*
|
|
1177
1457
|
* @category Block Groups
|
|
1178
1458
|
* @param ids - An array of block ids.
|
|
1179
1459
|
* @returns Whether the blocks can be grouped together.
|
|
@@ -1182,6 +1462,12 @@ export declare class BlockAPI {
|
|
|
1182
1462
|
/**
|
|
1183
1463
|
* Groups multiple blocks into a new group block.
|
|
1184
1464
|
*
|
|
1465
|
+
* ```javascript
|
|
1466
|
+
* if (engine.block.isGroupable([block1, block2])) {
|
|
1467
|
+
* const group = engine.block.group(block1, block2]);
|
|
1468
|
+
* }
|
|
1469
|
+
* ```
|
|
1470
|
+
*
|
|
1185
1471
|
* @category Block Groups
|
|
1186
1472
|
* @param ids - A non-empty array of block ids.
|
|
1187
1473
|
* @returns The block id of the created group.
|
|
@@ -1190,6 +1476,10 @@ export declare class BlockAPI {
|
|
|
1190
1476
|
/**
|
|
1191
1477
|
* Ungroups a group block, releasing its children.
|
|
1192
1478
|
*
|
|
1479
|
+
* ```javascript
|
|
1480
|
+
* engine.block.ungroup(group);
|
|
1481
|
+
* ```
|
|
1482
|
+
*
|
|
1193
1483
|
* @category Block Groups
|
|
1194
1484
|
* @param id - The group id from a previous call to `group`.
|
|
1195
1485
|
*/
|
|
@@ -1199,6 +1489,10 @@ export declare class BlockAPI {
|
|
|
1199
1489
|
*
|
|
1200
1490
|
* Nothing happens if the target is not a group.
|
|
1201
1491
|
*
|
|
1492
|
+
* ```javascript
|
|
1493
|
+
* engine.block.enterGroup(group);
|
|
1494
|
+
* ```
|
|
1495
|
+
*
|
|
1202
1496
|
* @category Block Groups
|
|
1203
1497
|
* @param id - The group id from a previous call to `group`.
|
|
1204
1498
|
*/
|
|
@@ -1208,6 +1502,10 @@ export declare class BlockAPI {
|
|
|
1208
1502
|
*
|
|
1209
1503
|
* Nothing happens if the block is not part of a group.
|
|
1210
1504
|
*
|
|
1505
|
+
* ```javascript
|
|
1506
|
+
* engine.block.exitGroup(member1);
|
|
1507
|
+
* ```
|
|
1508
|
+
*
|
|
1211
1509
|
* @category Block Groups
|
|
1212
1510
|
* @param id - A block id.
|
|
1213
1511
|
*/
|
|
@@ -1278,6 +1576,10 @@ export declare class BlockAPI {
|
|
|
1278
1576
|
/**
|
|
1279
1577
|
* Finds all blocks with a given kind.
|
|
1280
1578
|
*
|
|
1579
|
+
* ```javascript
|
|
1580
|
+
* const allTitles = engine.block.findByKind('title');
|
|
1581
|
+
* ```
|
|
1582
|
+
*
|
|
1281
1583
|
* @category Block Exploration
|
|
1282
1584
|
* @param kind - The kind to search for.
|
|
1283
1585
|
* @returns A list of block ids.
|
|
@@ -1300,6 +1602,12 @@ export declare class BlockAPI {
|
|
|
1300
1602
|
/**
|
|
1301
1603
|
* Creates a new shape block of a given type.
|
|
1302
1604
|
*
|
|
1605
|
+
* ```javascript
|
|
1606
|
+
* const star = engine.block.createShape('star');
|
|
1607
|
+
* // Longhand shape types are also supported
|
|
1608
|
+
* const rect = engine.block.createShape('//ly.img.ubq/shape/rect');
|
|
1609
|
+
* ```
|
|
1610
|
+
*
|
|
1303
1611
|
* @category Block Shapes
|
|
1304
1612
|
* @param type - The type of the shape object that shall be created.
|
|
1305
1613
|
* @returns The created shape's handle.
|
|
@@ -1430,6 +1738,10 @@ export declare class BlockAPI {
|
|
|
1430
1738
|
*
|
|
1431
1739
|
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
1432
1740
|
*
|
|
1741
|
+
* ```javascript
|
|
1742
|
+
* engine.block.setPositionX(block, 0.25);
|
|
1743
|
+
* ```
|
|
1744
|
+
*
|
|
1433
1745
|
* @category Block Layout
|
|
1434
1746
|
* @param id - The block to update.
|
|
1435
1747
|
* @param value - The value of the x position.
|
|
@@ -1438,6 +1750,10 @@ export declare class BlockAPI {
|
|
|
1438
1750
|
/**
|
|
1439
1751
|
* Sets the mode for the block's X position.
|
|
1440
1752
|
*
|
|
1753
|
+
* ```javascript
|
|
1754
|
+
* engine.block.setPositionXMode(block, 'Percent');
|
|
1755
|
+
* ```
|
|
1756
|
+
*
|
|
1441
1757
|
* @category Block Layout
|
|
1442
1758
|
* @param id - The block to update.
|
|
1443
1759
|
* @param mode - The x position mode: 'Absolute' or 'Percent'.
|
|
@@ -1448,6 +1764,10 @@ export declare class BlockAPI {
|
|
|
1448
1764
|
*
|
|
1449
1765
|
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
1450
1766
|
*
|
|
1767
|
+
* ```javascript
|
|
1768
|
+
* engine.block.setPositionY(block, 0.25);
|
|
1769
|
+
* ```
|
|
1770
|
+
*
|
|
1451
1771
|
* @category Block Layout
|
|
1452
1772
|
* @param id - The block to update.
|
|
1453
1773
|
* @param value - The value of the y position.
|
|
@@ -1456,6 +1776,10 @@ export declare class BlockAPI {
|
|
|
1456
1776
|
/**
|
|
1457
1777
|
* Sets the mode for the block's Y position.
|
|
1458
1778
|
*
|
|
1779
|
+
* ```javascript
|
|
1780
|
+
* engine.block.setPositionYMode(block, 'Absolute');
|
|
1781
|
+
* ```
|
|
1782
|
+
*
|
|
1459
1783
|
* @category Block Layout
|
|
1460
1784
|
* @param id - The block to update.
|
|
1461
1785
|
* @param mode - The y position mode: 'Absolute' or 'Percent'.
|
|
@@ -1603,6 +1927,10 @@ export declare class BlockAPI {
|
|
|
1603
1927
|
/**
|
|
1604
1928
|
* Gets the width of a block.
|
|
1605
1929
|
*
|
|
1930
|
+
* ```javascript
|
|
1931
|
+
* const width = engine.block.getWidth(block);
|
|
1932
|
+
* ```
|
|
1933
|
+
*
|
|
1606
1934
|
* @category Block Layout
|
|
1607
1935
|
* @param id - The block to query.
|
|
1608
1936
|
* @returns The value of the block's width.
|
|
@@ -1611,6 +1939,10 @@ export declare class BlockAPI {
|
|
|
1611
1939
|
/**
|
|
1612
1940
|
* Gets the mode for the block's width.
|
|
1613
1941
|
*
|
|
1942
|
+
* ```javascript
|
|
1943
|
+
* const widthMode = engine.block.getWidthMode(block);
|
|
1944
|
+
* ```
|
|
1945
|
+
*
|
|
1614
1946
|
* @category Block Layout
|
|
1615
1947
|
* @param id - The block to query.
|
|
1616
1948
|
* @returns The current mode for the width: 'Absolute', 'Percent' or 'Auto'.
|
|
@@ -1619,6 +1951,10 @@ export declare class BlockAPI {
|
|
|
1619
1951
|
/**
|
|
1620
1952
|
* Gets the height of a block.
|
|
1621
1953
|
*
|
|
1954
|
+
* ```javascript
|
|
1955
|
+
* const height = engine.block.getHeight(block);
|
|
1956
|
+
* ```
|
|
1957
|
+
*
|
|
1622
1958
|
* @category Block Layout
|
|
1623
1959
|
* @param id - The block to query.
|
|
1624
1960
|
* @returns The value of the block's height.
|
|
@@ -1627,13 +1963,41 @@ export declare class BlockAPI {
|
|
|
1627
1963
|
/**
|
|
1628
1964
|
* Gets the mode for the block's height.
|
|
1629
1965
|
*
|
|
1966
|
+
* ```javascript
|
|
1967
|
+
* const heightMode = engine.block.getHeightMode(block);
|
|
1968
|
+
* ```
|
|
1969
|
+
*
|
|
1630
1970
|
* @category Block Layout
|
|
1631
1971
|
* @param id - The block to query.
|
|
1632
1972
|
* @returns The current mode for the height: 'Absolute', 'Percent' or 'Auto'.
|
|
1633
1973
|
*/
|
|
1634
1974
|
getHeightMode(id: DesignBlockId): SizeMode;
|
|
1635
1975
|
/**
|
|
1636
|
-
*
|
|
1976
|
+
* Update a block's size.
|
|
1977
|
+
* @param id - The block to update.
|
|
1978
|
+
* @param width - The new width of the block.
|
|
1979
|
+
* @param height - The new height of the block.
|
|
1980
|
+
* @param options - Optional parameters for the size. Properties:
|
|
1981
|
+
* - `maintainCrop` - Whether or not the crop values, if available, should be automatically adjusted.
|
|
1982
|
+
* - `sizeMode` - The size mode: Absolute, Percent or Auto.
|
|
1983
|
+
*/
|
|
1984
|
+
setSize(id: DesignBlockId, width: number, height: number, options?: {
|
|
1985
|
+
maintainCrop?: boolean;
|
|
1986
|
+
sizeMode?: SizeMode;
|
|
1987
|
+
}): void;
|
|
1988
|
+
/**
|
|
1989
|
+
* Update a block's position.
|
|
1990
|
+
* @param id - The block to update.
|
|
1991
|
+
* @param x - The new x position of the block.
|
|
1992
|
+
* @param y - The new y position of the block.
|
|
1993
|
+
* @param options - Optional parameters for the position. Properties:
|
|
1994
|
+
* - `positionMode` - The position mode: absolute, percent or undefined.
|
|
1995
|
+
*/
|
|
1996
|
+
setPosition(id: DesignBlockId, x: number, y: number, options?: {
|
|
1997
|
+
positionMode?: PositionMode;
|
|
1998
|
+
}): void;
|
|
1999
|
+
/**
|
|
2000
|
+
* Update a block's width and optionally maintain the crop.
|
|
1637
2001
|
*
|
|
1638
2002
|
* If the crop is maintained, the crop values will be automatically adjusted.
|
|
1639
2003
|
*
|
|
@@ -1746,6 +2110,10 @@ export declare class BlockAPI {
|
|
|
1746
2110
|
/**
|
|
1747
2111
|
* Sets the content fill mode of a block.
|
|
1748
2112
|
*
|
|
2113
|
+
* ```javascript
|
|
2114
|
+
* engine.block.setContentFillMode(image, 'Cover');
|
|
2115
|
+
* ```
|
|
2116
|
+
*
|
|
1749
2117
|
* @category Block Fills
|
|
1750
2118
|
* @param id - The block to update.
|
|
1751
2119
|
* @param mode - The content fill mode: 'Crop', 'Cover' or 'Contain'.
|
|
@@ -1754,6 +2122,10 @@ export declare class BlockAPI {
|
|
|
1754
2122
|
/**
|
|
1755
2123
|
* Gets the content fill mode of a block.
|
|
1756
2124
|
*
|
|
2125
|
+
* ```javascript
|
|
2126
|
+
* engine.block.getContentFillMode(image);
|
|
2127
|
+
* ```
|
|
2128
|
+
*
|
|
1757
2129
|
* @category Block Fills
|
|
1758
2130
|
* @param id - The block to query.
|
|
1759
2131
|
* @returns The current mode: 'Crop', 'Cover' or 'Contain'.
|
|
@@ -1965,6 +2337,11 @@ export declare class BlockAPI {
|
|
|
1965
2337
|
* Resizes blocks while adjusting content to fit.
|
|
1966
2338
|
*
|
|
1967
2339
|
* The content of the blocks is automatically adjusted to fit the new dimensions.
|
|
2340
|
+
* Full-page blocks are resized to remain as full-page afterwards, while the blocks that are not full-page get resized as a group to the same scale factor and centered.
|
|
2341
|
+
* ```javascript
|
|
2342
|
+
* const pages = engine.scene.getPages();
|
|
2343
|
+
* engine.block.resizeContentAware(pages, width: 100.0, 100.0);
|
|
2344
|
+
* ```
|
|
1968
2345
|
*
|
|
1969
2346
|
* @category Block Layout
|
|
1970
2347
|
* @param ids - The blocks to resize.
|
|
@@ -2033,6 +2410,10 @@ export declare class BlockAPI {
|
|
|
2033
2410
|
/**
|
|
2034
2411
|
* Sets a boolean property on a block.
|
|
2035
2412
|
*
|
|
2413
|
+
* ```javascript
|
|
2414
|
+
* engine.block.setBool(scene, 'scene/aspectRatioLock', false);
|
|
2415
|
+
* ```
|
|
2416
|
+
*
|
|
2036
2417
|
* @category Block Properties
|
|
2037
2418
|
* @param id - The block whose property should be set.
|
|
2038
2419
|
* @param property - The name of the property to set.
|
|
@@ -2042,6 +2423,10 @@ export declare class BlockAPI {
|
|
|
2042
2423
|
/**
|
|
2043
2424
|
* Gets a boolean property from a block.
|
|
2044
2425
|
*
|
|
2426
|
+
* ```javascript
|
|
2427
|
+
* engine.block.getBool(scene, 'scene/aspectRatioLock');
|
|
2428
|
+
* ```
|
|
2429
|
+
*
|
|
2045
2430
|
* @category Block Properties
|
|
2046
2431
|
* @param id - The block whose property should be queried.
|
|
2047
2432
|
* @param property - The name of the property to query.
|
|
@@ -2051,6 +2436,10 @@ export declare class BlockAPI {
|
|
|
2051
2436
|
/**
|
|
2052
2437
|
* Sets an integer property on a block.
|
|
2053
2438
|
*
|
|
2439
|
+
* ```javascript
|
|
2440
|
+
* engine.block.setInt(starShape, 'shape/star/points', points + 2);
|
|
2441
|
+
* ```
|
|
2442
|
+
*
|
|
2054
2443
|
* @category Block Properties
|
|
2055
2444
|
* @param id - The block whose property should be set.
|
|
2056
2445
|
* @param property - The name of the property to set.
|
|
@@ -2060,6 +2449,10 @@ export declare class BlockAPI {
|
|
|
2060
2449
|
/**
|
|
2061
2450
|
* Gets an integer property from a block.
|
|
2062
2451
|
*
|
|
2452
|
+
* ```javascript
|
|
2453
|
+
* engine.block.setInt(starShape, 'shape/star/points', points + 2);
|
|
2454
|
+
* ```
|
|
2455
|
+
*
|
|
2063
2456
|
* @category Block Properties
|
|
2064
2457
|
* @param id - The block whose property should be queried.
|
|
2065
2458
|
* @param property - The name of the property to query.
|
|
@@ -2070,7 +2463,6 @@ export declare class BlockAPI {
|
|
|
2070
2463
|
* Sets a float property on a block.
|
|
2071
2464
|
*
|
|
2072
2465
|
* ```javascript
|
|
2073
|
-
* // Set the properties of a text block.
|
|
2074
2466
|
* engine.block.setFloat(text, "text/letterSpacing", 0.2);
|
|
2075
2467
|
* engine.block.setFloat(text, "text/lineHeight", 1.2);
|
|
2076
2468
|
* ```
|
|
@@ -2084,6 +2476,10 @@ export declare class BlockAPI {
|
|
|
2084
2476
|
/**
|
|
2085
2477
|
* Gets a float property from a block.
|
|
2086
2478
|
*
|
|
2479
|
+
* ```javascript
|
|
2480
|
+
* engine.block.getFloat(starShape, 'shape/star/innerDiameter');
|
|
2481
|
+
* ```
|
|
2482
|
+
*
|
|
2087
2483
|
* @category Block Properties
|
|
2088
2484
|
* @param id - The block whose property should be queried.
|
|
2089
2485
|
* @param property - The name of the property to query.
|
|
@@ -2093,6 +2489,10 @@ export declare class BlockAPI {
|
|
|
2093
2489
|
/**
|
|
2094
2490
|
* Sets a double-precision float property on a block.
|
|
2095
2491
|
*
|
|
2492
|
+
* ```javascript
|
|
2493
|
+
* engine.block.setDouble(audio, 'playback/duration', 1.0);
|
|
2494
|
+
* ```
|
|
2495
|
+
*
|
|
2096
2496
|
* @category Block Properties
|
|
2097
2497
|
* @param id - The block whose property should be set.
|
|
2098
2498
|
* @param property - The name of the property to set.
|
|
@@ -2102,6 +2502,10 @@ export declare class BlockAPI {
|
|
|
2102
2502
|
/**
|
|
2103
2503
|
* Gets a double-precision float property from a block.
|
|
2104
2504
|
*
|
|
2505
|
+
* ```javascript
|
|
2506
|
+
* engine.block.getDouble(audio, 'playback/duration');
|
|
2507
|
+
* ```
|
|
2508
|
+
*
|
|
2105
2509
|
* @category Block Properties
|
|
2106
2510
|
* @param id - The block whose property should be queried.
|
|
2107
2511
|
* @param property - The name of the property to query.
|
|
@@ -2111,6 +2515,11 @@ export declare class BlockAPI {
|
|
|
2111
2515
|
/**
|
|
2112
2516
|
* Sets a string property on a block.
|
|
2113
2517
|
*
|
|
2518
|
+
* ```javascript
|
|
2519
|
+
* engine.block.setString(text, 'text/text', 'Hello World');
|
|
2520
|
+
* engine.block.setString(imageFill, 'fill/image/imageFileURI', 'https://example.com/sample.jpg');
|
|
2521
|
+
* ```
|
|
2522
|
+
*
|
|
2114
2523
|
* @category Block Properties
|
|
2115
2524
|
* @param id - The block whose property should be set.
|
|
2116
2525
|
* @param property - The name of the property to set.
|
|
@@ -2120,6 +2529,11 @@ export declare class BlockAPI {
|
|
|
2120
2529
|
/**
|
|
2121
2530
|
* Gets a string property from a block.
|
|
2122
2531
|
*
|
|
2532
|
+
* ```javascript
|
|
2533
|
+
* engine.block.getString(text, 'text/text');
|
|
2534
|
+
* engine.block.getString(imageFill, 'fill/image/imageFileURI');
|
|
2535
|
+
* ```
|
|
2536
|
+
*
|
|
2123
2537
|
* @category Block Properties
|
|
2124
2538
|
* @param id - The block whose property should be queried.
|
|
2125
2539
|
* @param property - The name of the property to query.
|
|
@@ -2129,6 +2543,11 @@ export declare class BlockAPI {
|
|
|
2129
2543
|
/**
|
|
2130
2544
|
* Sets a color property on a block.
|
|
2131
2545
|
*
|
|
2546
|
+
* ```javascript
|
|
2547
|
+
* // Set the block's fill color to white.
|
|
2548
|
+
* engine.block.setColor(colorFill, 'fill/color/value', { r: 1, g: 1, b: 1, a: 1 });
|
|
2549
|
+
* ```
|
|
2550
|
+
*
|
|
2132
2551
|
* @category Block Properties
|
|
2133
2552
|
* @param id - The block whose property should be set.
|
|
2134
2553
|
* @param property - The name of the property to set.
|
|
@@ -2138,6 +2557,10 @@ export declare class BlockAPI {
|
|
|
2138
2557
|
/**
|
|
2139
2558
|
* Gets a color property from a block.
|
|
2140
2559
|
*
|
|
2560
|
+
* ```javascript
|
|
2561
|
+
* engine.block.getColor(colorFill, 'fill/color/value');
|
|
2562
|
+
* ```
|
|
2563
|
+
*
|
|
2141
2564
|
* @category Block Properties
|
|
2142
2565
|
* @param id - The block whose property should be queried.
|
|
2143
2566
|
* @param property - The name of the property to query.
|
|
@@ -2201,6 +2624,13 @@ export declare class BlockAPI {
|
|
|
2201
2624
|
/**
|
|
2202
2625
|
* Sets the color stops for a gradient property.
|
|
2203
2626
|
*
|
|
2627
|
+
* ```javascript
|
|
2628
|
+
* engine.block.setGradientColorStops(gradientFill, 'fill/gradient/colors', [
|
|
2629
|
+
* { color: { r: 1.0, g: 0.8, b: 0.2, a: 1.0 }, stop: 0 },
|
|
2630
|
+
* { color: { r: 0.3, g: 0.4, b: 0.7, a: 1.0 }, stop: 1 }
|
|
2631
|
+
* ]);
|
|
2632
|
+
* ```
|
|
2633
|
+
*
|
|
2204
2634
|
* @category Block Fills
|
|
2205
2635
|
* @param id - The block whose property should be set.
|
|
2206
2636
|
* @param property - The name of the property to set, e.g. 'fill/gradient/colors'.
|
|
@@ -2210,6 +2640,10 @@ export declare class BlockAPI {
|
|
|
2210
2640
|
/**
|
|
2211
2641
|
* Gets the color stops from a gradient property.
|
|
2212
2642
|
*
|
|
2643
|
+
* ```
|
|
2644
|
+
* engine.block.getGradientColorStops(gradientFill, 'fill/gradient/colors');
|
|
2645
|
+
* ```
|
|
2646
|
+
*
|
|
2213
2647
|
* @category Block Fills
|
|
2214
2648
|
* @param id - The block whose property should be queried.
|
|
2215
2649
|
* @param property - The name of the property to query.
|
|
@@ -2219,6 +2653,10 @@ export declare class BlockAPI {
|
|
|
2219
2653
|
/**
|
|
2220
2654
|
* Gets the source set from a block property.
|
|
2221
2655
|
*
|
|
2656
|
+
* ```javascript
|
|
2657
|
+
* const sourceSet = engine.block.getSourceSet(imageFill, 'fill/image/sourceSet');
|
|
2658
|
+
* ```
|
|
2659
|
+
*
|
|
2222
2660
|
* @category Block Fills
|
|
2223
2661
|
* @param id - The block that should be queried.
|
|
2224
2662
|
* @param property - The name of the property to query, e.g. 'fill/image/sourceSet'.
|
|
@@ -2230,6 +2668,14 @@ export declare class BlockAPI {
|
|
|
2230
2668
|
*
|
|
2231
2669
|
* The crop and content fill mode of the associated block will be reset to default values.
|
|
2232
2670
|
*
|
|
2671
|
+
* ```javascript
|
|
2672
|
+
* engine.block.setSourceSet(imageFill, 'fill/image/sourceSet', [{
|
|
2673
|
+
* uri: 'https://example.com/sample.jpg',
|
|
2674
|
+
* width: 800,
|
|
2675
|
+
* height: 600
|
|
2676
|
+
* }]);
|
|
2677
|
+
* ```
|
|
2678
|
+
*
|
|
2233
2679
|
* @category Block Fills
|
|
2234
2680
|
* @param id - The block whose property should be set.
|
|
2235
2681
|
* @param property - The name of the property to set.
|
|
@@ -2241,6 +2687,10 @@ export declare class BlockAPI {
|
|
|
2241
2687
|
*
|
|
2242
2688
|
* If an image with the same width already exists in the source set, it will be replaced.
|
|
2243
2689
|
*
|
|
2690
|
+
* ```javascript
|
|
2691
|
+
* await engine.block.addImageFileURIToSourceSet(imageFill, 'fill/image/sourceSet', 'https://example.com/sample.jpg');
|
|
2692
|
+
* ```
|
|
2693
|
+
*
|
|
2244
2694
|
* @category Block Fills
|
|
2245
2695
|
* @param id - The block to update.
|
|
2246
2696
|
* @param property - The name of the property to modify.
|
|
@@ -2253,6 +2703,10 @@ export declare class BlockAPI {
|
|
|
2253
2703
|
*
|
|
2254
2704
|
* If a video with the same width already exists in the source set, it will be replaced.
|
|
2255
2705
|
*
|
|
2706
|
+
* ```javascript
|
|
2707
|
+
* await engine.block.addVideoFileURIToSourceSet(videoFill, 'fill/video/sourceSet', 'https://example.com/sample.mp4');
|
|
2708
|
+
* ```
|
|
2709
|
+
*
|
|
2256
2710
|
* @category Block Fills
|
|
2257
2711
|
* @param id - The block to update.
|
|
2258
2712
|
* @param property - The name of the property to modify.
|
|
@@ -2267,6 +2721,7 @@ export declare class BlockAPI {
|
|
|
2267
2721
|
* engine.block.setEnum(text, 'text/horizontalAlignment', 'Center');
|
|
2268
2722
|
* engine.block.setEnum(text, 'text/verticalAlignment', 'Center');
|
|
2269
2723
|
* ```
|
|
2724
|
+
*
|
|
2270
2725
|
* @category Block Properties
|
|
2271
2726
|
* @param id - The block whose property should be set.
|
|
2272
2727
|
* @param property - The name of the property to set.
|
|
@@ -2702,6 +3157,10 @@ export declare class BlockAPI {
|
|
|
2702
3157
|
/**
|
|
2703
3158
|
* Sets the enabled state of an effect block.
|
|
2704
3159
|
*
|
|
3160
|
+
* ```javascript
|
|
3161
|
+
* engine.block.setEffectEnabled(effects[0], false);
|
|
3162
|
+
* ```
|
|
3163
|
+
*
|
|
2705
3164
|
* @category Block Effects
|
|
2706
3165
|
* @param effectId - The 'effect' block to update.
|
|
2707
3166
|
* @param enabled - The new state.
|
|
@@ -2710,6 +3169,10 @@ export declare class BlockAPI {
|
|
|
2710
3169
|
/**
|
|
2711
3170
|
* Queries if an effect block is enabled.
|
|
2712
3171
|
*
|
|
3172
|
+
* ```javascript
|
|
3173
|
+
* engine.block.isEffectEnabled(effects[0]);
|
|
3174
|
+
* ```
|
|
3175
|
+
*
|
|
2713
3176
|
* @category Block Effects
|
|
2714
3177
|
* @param effectId - The 'effect' block to query.
|
|
2715
3178
|
* @returns True, if the effect is enabled. False otherwise.
|
|
@@ -2759,6 +3222,10 @@ export declare class BlockAPI {
|
|
|
2759
3222
|
/**
|
|
2760
3223
|
* Enables or disables the blur effect on a block.
|
|
2761
3224
|
*
|
|
3225
|
+
* ```javascript
|
|
3226
|
+
* engine.block.setBlurEnabled(block, true);
|
|
3227
|
+
* ```
|
|
3228
|
+
*
|
|
2762
3229
|
* @category Block Blur
|
|
2763
3230
|
* @param id - The block to update.
|
|
2764
3231
|
* @param enabled - The new enabled value.
|
|
@@ -2767,6 +3234,10 @@ export declare class BlockAPI {
|
|
|
2767
3234
|
/**
|
|
2768
3235
|
* Checks if blur is enabled for a block.
|
|
2769
3236
|
*
|
|
3237
|
+
* ```javascript
|
|
3238
|
+
* const isBlurEnabled = engine.block.isBlurEnabled(block);
|
|
3239
|
+
* ```
|
|
3240
|
+
*
|
|
2770
3241
|
* @category Block Blur
|
|
2771
3242
|
* @param id - The block to query.
|
|
2772
3243
|
* @returns True, if the blur is enabled. False otherwise.
|
|
@@ -2813,6 +3284,10 @@ export declare class BlockAPI {
|
|
|
2813
3284
|
/**
|
|
2814
3285
|
* Enables or disables the background of a block.
|
|
2815
3286
|
*
|
|
3287
|
+
* ```javascript
|
|
3288
|
+
* engine.block.setBackgroundColorEnabled(block, true);
|
|
3289
|
+
* ```
|
|
3290
|
+
*
|
|
2816
3291
|
* @category Block Appearance
|
|
2817
3292
|
* @param id - The block whose background should be enabled or disabled.
|
|
2818
3293
|
* @param enabled - If true, the background will be enabled.
|
|
@@ -2821,6 +3296,10 @@ export declare class BlockAPI {
|
|
|
2821
3296
|
/**
|
|
2822
3297
|
* Checks if the background of a block is enabled.
|
|
2823
3298
|
*
|
|
3299
|
+
* ```javascript
|
|
3300
|
+
* const backgroundColorIsEnabled = engine.block.isBackgroundColorEnabled(block);
|
|
3301
|
+
* ```
|
|
3302
|
+
*
|
|
2824
3303
|
* @category Block Appearance
|
|
2825
3304
|
* @param id - The block whose background state should be queried.
|
|
2826
3305
|
* @returns True, if background is enabled.
|
|
@@ -2846,6 +3325,10 @@ export declare class BlockAPI {
|
|
|
2846
3325
|
/**
|
|
2847
3326
|
* Enables or disables the stroke of a block.
|
|
2848
3327
|
*
|
|
3328
|
+
* ```javascript
|
|
3329
|
+
* engine.block.setStrokeEnabled(block, true);
|
|
3330
|
+
* ```
|
|
3331
|
+
*
|
|
2849
3332
|
* @category Block Strokes
|
|
2850
3333
|
* @param id - The block whose stroke should be enabled or disabled.
|
|
2851
3334
|
* @param enabled - If true, the stroke will be enabled.
|
|
@@ -2854,6 +3337,10 @@ export declare class BlockAPI {
|
|
|
2854
3337
|
/**
|
|
2855
3338
|
* Checks if the stroke of a block is enabled.
|
|
2856
3339
|
*
|
|
3340
|
+
* ```javascript
|
|
3341
|
+
* const strokeIsEnabled = engine.block.isStrokeEnabled(block);
|
|
3342
|
+
* ```
|
|
3343
|
+
*
|
|
2857
3344
|
* @category Block Strokes
|
|
2858
3345
|
* @param id - The block whose stroke state should be queried.
|
|
2859
3346
|
* @returns True if the block's stroke is enabled.
|
|
@@ -2980,6 +3467,10 @@ export declare class BlockAPI {
|
|
|
2980
3467
|
/**
|
|
2981
3468
|
* Enables or disables the drop shadow of a block.
|
|
2982
3469
|
*
|
|
3470
|
+
* ```javascript
|
|
3471
|
+
* engine.block.setDropShadowEnabled(block, true);
|
|
3472
|
+
* ```
|
|
3473
|
+
*
|
|
2983
3474
|
* @category Block Drop Shadow
|
|
2984
3475
|
* @param id - The block whose drop shadow should be enabled or disabled.
|
|
2985
3476
|
* @param enabled - If true, the drop shadow will be enabled.
|
|
@@ -2988,6 +3479,10 @@ export declare class BlockAPI {
|
|
|
2988
3479
|
/**
|
|
2989
3480
|
* Checks if the drop shadow of a block is enabled.
|
|
2990
3481
|
*
|
|
3482
|
+
* ```javascript
|
|
3483
|
+
* const dropShadowIsEnabled = engine.block.isDropShadowEnabled(block);
|
|
3484
|
+
* ```
|
|
3485
|
+
*
|
|
2991
3486
|
* @category Block Drop Shadow
|
|
2992
3487
|
* @param id - The block whose drop shadow state should be queried.
|
|
2993
3488
|
* @returns True if the block's drop shadow is enabled.
|
|
@@ -3502,6 +3997,10 @@ export declare class BlockAPI {
|
|
|
3502
3997
|
/**
|
|
3503
3998
|
* Checks if the fill of a block is enabled.
|
|
3504
3999
|
*
|
|
4000
|
+
* ```javascript
|
|
4001
|
+
* engine.block.isFillEnabled(block);
|
|
4002
|
+
* ```
|
|
4003
|
+
*
|
|
3505
4004
|
* @category Block Fills
|
|
3506
4005
|
* @param id - The block whose fill state should be queried.
|
|
3507
4006
|
* @returns The fill state.
|
|
@@ -3510,6 +4009,10 @@ export declare class BlockAPI {
|
|
|
3510
4009
|
/**
|
|
3511
4010
|
* Enables or disables the fill of a block.
|
|
3512
4011
|
*
|
|
4012
|
+
* ```javascript
|
|
4013
|
+
* engine.block.setFillEnabled(block, false);
|
|
4014
|
+
* ```
|
|
4015
|
+
*
|
|
3513
4016
|
* @category Block Fills
|
|
3514
4017
|
* @param id - The block whose fill should be enabled or disabled.
|
|
3515
4018
|
* @param enabled - If true, the fill will be enabled.
|
|
@@ -3555,6 +4058,12 @@ export declare class BlockAPI {
|
|
|
3555
4058
|
/**
|
|
3556
4059
|
* Enables or disables the placeholder function for a block.
|
|
3557
4060
|
*
|
|
4061
|
+
* When set to `true`, the placeholder capabilities are enabled in Adopter mode.
|
|
4062
|
+
*
|
|
4063
|
+
* ```javascript
|
|
4064
|
+
* engine.block.setPlaceholderEnabled(block, true);
|
|
4065
|
+
* ```
|
|
4066
|
+
*
|
|
3558
4067
|
* @category Block Placeholder
|
|
3559
4068
|
* @param id - The block whose placeholder function should be enabled or disabled.
|
|
3560
4069
|
* @param enabled - Whether the function should be enabled or disabled.
|
|
@@ -3563,6 +4072,10 @@ export declare class BlockAPI {
|
|
|
3563
4072
|
/**
|
|
3564
4073
|
* Checks if the placeholder function for a block is enabled.
|
|
3565
4074
|
*
|
|
4075
|
+
* ```javascript
|
|
4076
|
+
* const placeholderIsEnabled = engine.block.isPlaceholderEnabled(block);
|
|
4077
|
+
* ```
|
|
4078
|
+
*
|
|
3566
4079
|
* @category Block Placeholder
|
|
3567
4080
|
* @param id - The block whose placeholder function state should be queried.
|
|
3568
4081
|
* @returns The enabled state of the placeholder function.
|
|
@@ -3580,6 +4093,10 @@ export declare class BlockAPI {
|
|
|
3580
4093
|
/**
|
|
3581
4094
|
* Checks if a block supports placeholder behavior.
|
|
3582
4095
|
*
|
|
4096
|
+
* ```javascript
|
|
4097
|
+
* const placeholderBehaviorSupported = engine.block.supportsPlaceholderBehavior(block);
|
|
4098
|
+
* ```
|
|
4099
|
+
*
|
|
3583
4100
|
* @category Block Placeholder
|
|
3584
4101
|
* @param id - The block to query.
|
|
3585
4102
|
* @returns True, if the block supports placeholder behavior.
|
|
@@ -3588,6 +4105,10 @@ export declare class BlockAPI {
|
|
|
3588
4105
|
/**
|
|
3589
4106
|
* Enables or disables the placeholder behavior for a block.
|
|
3590
4107
|
*
|
|
4108
|
+
* ```javascript
|
|
4109
|
+
* engine.block.setPlaceholderBehaviorEnabled(block, true);
|
|
4110
|
+
* ```
|
|
4111
|
+
*
|
|
3591
4112
|
* @category Block Placeholder
|
|
3592
4113
|
* @param id - The block whose placeholder behavior should be enabled or disabled.
|
|
3593
4114
|
* @param enabled - Whether the placeholder behavior should be enabled or disabled.
|
|
@@ -3596,6 +4117,10 @@ export declare class BlockAPI {
|
|
|
3596
4117
|
/**
|
|
3597
4118
|
* Checks if the placeholder behavior for a block is enabled.
|
|
3598
4119
|
*
|
|
4120
|
+
* ```javascript
|
|
4121
|
+
* engine.block.setPlaceholderBehaviorEnabled(block, true);
|
|
4122
|
+
* ```
|
|
4123
|
+
*
|
|
3599
4124
|
* @category Block Placeholder
|
|
3600
4125
|
* @param id - The block whose placeholder behavior state should be queried.
|
|
3601
4126
|
* @returns The enabled state of the placeholder behavior.
|
|
@@ -3621,6 +4146,10 @@ export declare class BlockAPI {
|
|
|
3621
4146
|
/**
|
|
3622
4147
|
* Enables or disables the placeholder overlay pattern.
|
|
3623
4148
|
*
|
|
4149
|
+
* ```javascript
|
|
4150
|
+
* engine.block.setPlaceholderControlsOverlayEnabled(block, true);
|
|
4151
|
+
* ```
|
|
4152
|
+
*
|
|
3624
4153
|
* @category Block Placeholder
|
|
3625
4154
|
* @param id - The block whose placeholder overlay should be enabled or disabled.
|
|
3626
4155
|
* @param enabled - Whether the placeholder overlay should be shown or not.
|
|
@@ -3629,6 +4158,10 @@ export declare class BlockAPI {
|
|
|
3629
4158
|
/**
|
|
3630
4159
|
* Checks if the placeholder overlay pattern is enabled.
|
|
3631
4160
|
*
|
|
4161
|
+
* ```javascript
|
|
4162
|
+
* const overlayEnabled = engine.block.isPlaceholderControlsOverlayEnabled(block);
|
|
4163
|
+
* ```
|
|
4164
|
+
*
|
|
3632
4165
|
* @category Block Placeholder
|
|
3633
4166
|
* @param id - The block whose placeholder overlay visibility state should be queried.
|
|
3634
4167
|
* @returns The visibility state of the block's placeholder overlay pattern.
|
|
@@ -3637,6 +4170,10 @@ export declare class BlockAPI {
|
|
|
3637
4170
|
/**
|
|
3638
4171
|
* Enables or disables the placeholder button.
|
|
3639
4172
|
*
|
|
4173
|
+
* ```javascript
|
|
4174
|
+
* engine.block.setPlaceholderControlsButtonEnabled(block, true);
|
|
4175
|
+
* ```
|
|
4176
|
+
*
|
|
3640
4177
|
* @category Block Placeholder
|
|
3641
4178
|
* @param id - The block whose placeholder button should be shown or not.
|
|
3642
4179
|
* @param enabled - Whether the placeholder button should be shown or not.
|
|
@@ -3645,6 +4182,10 @@ export declare class BlockAPI {
|
|
|
3645
4182
|
/**
|
|
3646
4183
|
* Checks if the placeholder button is enabled.
|
|
3647
4184
|
*
|
|
4185
|
+
* ```javascript
|
|
4186
|
+
* const buttonEnabled = engine.block.isPlaceholderControlsButtonEnabled(block);
|
|
4187
|
+
* ```
|
|
4188
|
+
*
|
|
3648
4189
|
* @category Block Placeholder
|
|
3649
4190
|
* @param id - The block whose placeholder button visibility state should be queried.
|
|
3650
4191
|
* @returns The visibility state of the block's placeholder button.
|
|
@@ -3698,6 +4239,11 @@ export declare class BlockAPI {
|
|
|
3698
4239
|
/**
|
|
3699
4240
|
* Enables or disables a scope for a block.
|
|
3700
4241
|
*
|
|
4242
|
+
* ```javascript
|
|
4243
|
+
* // Allow the user to move the image block.
|
|
4244
|
+
* engine.block.setScopeEnabled(image, 'layer/move', true);
|
|
4245
|
+
* ```
|
|
4246
|
+
*
|
|
3701
4247
|
* @category Block Scopes
|
|
3702
4248
|
* @param id - The block whose scope should be enabled or disabled.
|
|
3703
4249
|
* @param key - The scope to enable or disable.
|
|
@@ -3707,6 +4253,10 @@ export declare class BlockAPI {
|
|
|
3707
4253
|
/**
|
|
3708
4254
|
* Checks if a scope is enabled for a block.
|
|
3709
4255
|
*
|
|
4256
|
+
* ```javascript
|
|
4257
|
+
* engine.block.isScopeEnabled(image, 'layer/move');
|
|
4258
|
+
* ```
|
|
4259
|
+
*
|
|
3710
4260
|
* @category Block Scopes
|
|
3711
4261
|
* @param id - The block whose scope state should be queried.
|
|
3712
4262
|
* @param key - The scope to query.
|
|
@@ -3716,6 +4266,11 @@ export declare class BlockAPI {
|
|
|
3716
4266
|
/**
|
|
3717
4267
|
* Checks if an operation is allowed by a block's scopes.
|
|
3718
4268
|
*
|
|
4269
|
+
* ```javascript
|
|
4270
|
+
* // This will return true when the global scope is set to 'Defer'.
|
|
4271
|
+
* engine.block.isAllowedByScope(image, 'layer/move');
|
|
4272
|
+
* ```
|
|
4273
|
+
*
|
|
3719
4274
|
* @category Block Scopes
|
|
3720
4275
|
* @param id - The block to check.
|
|
3721
4276
|
* @param key - The scope to check.
|
|
@@ -3952,6 +4507,10 @@ export declare class BlockAPI {
|
|
|
3952
4507
|
*
|
|
3953
4508
|
* When enabled, only this block's content will play while the rest of the scene remains paused.
|
|
3954
4509
|
*
|
|
4510
|
+
* ```javascript
|
|
4511
|
+
* engine.block.setSoloPlaybackEnabled(videoFill, true);
|
|
4512
|
+
* ```
|
|
4513
|
+
*
|
|
3955
4514
|
* @category Block Video
|
|
3956
4515
|
* @param id - The block or fill to update.
|
|
3957
4516
|
* @param enabled - Whether solo playback should be enabled.
|
|
@@ -3960,6 +4519,10 @@ export declare class BlockAPI {
|
|
|
3960
4519
|
/**
|
|
3961
4520
|
* Checks if solo playback is enabled for a block.
|
|
3962
4521
|
*
|
|
4522
|
+
* ```javascript
|
|
4523
|
+
* engine.block.isSoloPlaybackEnabled(videoFill);
|
|
4524
|
+
* ```
|
|
4525
|
+
*
|
|
3963
4526
|
* @category Block Video
|
|
3964
4527
|
* @param id - The block or fill to query.
|
|
3965
4528
|
* @returns Whether solo playback is enabled for this block.
|
|
@@ -4217,6 +4780,10 @@ export declare class BlockAPI {
|
|
|
4217
4780
|
*
|
|
4218
4781
|
* A block's state is determined by its own state and that of its shape, fill, and effects.
|
|
4219
4782
|
*
|
|
4783
|
+
* ```javascript
|
|
4784
|
+
* const state = engine.block.getState(block);
|
|
4785
|
+
* ```
|
|
4786
|
+
*
|
|
4220
4787
|
* @category Block State
|
|
4221
4788
|
* @param id - The block to query.
|
|
4222
4789
|
* @returns The block's state: 'Ready', 'Pending', or 'Error'.
|
|
@@ -4225,6 +4792,12 @@ export declare class BlockAPI {
|
|
|
4225
4792
|
/**
|
|
4226
4793
|
* Sets the state of a block.
|
|
4227
4794
|
*
|
|
4795
|
+
* ```javascript
|
|
4796
|
+
* engine.block.setState(video, {type: 'Pending', progress: 0.5});
|
|
4797
|
+
* engine.block.setState(page, {type: 'Ready'});
|
|
4798
|
+
* engine.block.setState(image, {type: 'Error', error: 'ImageDecoding'});
|
|
4799
|
+
* ```
|
|
4800
|
+
*
|
|
4228
4801
|
* @category Block State
|
|
4229
4802
|
* @param id - The block whose state should be set.
|
|
4230
4803
|
* @param state - The new state to set.
|
|
@@ -4235,6 +4808,12 @@ export declare class BlockAPI {
|
|
|
4235
4808
|
*
|
|
4236
4809
|
* The state is determined by the block and its associated shape, fill, and effects.
|
|
4237
4810
|
*
|
|
4811
|
+
* ```javascript
|
|
4812
|
+
* const unsubscribe = engine.block.onStateChanged([], (blocks) => {
|
|
4813
|
+
* blocks.forEach(block => console.log(block));
|
|
4814
|
+
* });
|
|
4815
|
+
* ```
|
|
4816
|
+
*
|
|
4238
4817
|
* @category Block Events
|
|
4239
4818
|
* @param ids - A list of block IDs to monitor. If empty, all blocks are monitored.
|
|
4240
4819
|
* @param callback - The function to call when a state changes.
|
|
@@ -4251,6 +4830,72 @@ export declare class BlockAPI {
|
|
|
4251
4830
|
* @returns A Promise that resolves once all resources have finished loading.
|
|
4252
4831
|
*/
|
|
4253
4832
|
forceLoadResources(ids: DesignBlockId[]): Promise<void>;
|
|
4833
|
+
/**
|
|
4834
|
+
* Adds an image to the current page. The image will be automatically loaded
|
|
4835
|
+
* and sized appropriately. In Video mode, timeline and animation options can be applied.
|
|
4836
|
+
*
|
|
4837
|
+
* @param url - URL or path to the image file
|
|
4838
|
+
* @param options - Configuration options for the image
|
|
4839
|
+
* @returns Promise that resolves to the ID of the created image block
|
|
4840
|
+
* @throws Error if no current page exists
|
|
4841
|
+
*/
|
|
4842
|
+
addImage(url: string, options?: AddImageOptions): Promise<DesignBlockId>;
|
|
4843
|
+
/**
|
|
4844
|
+
* Adds a video block to the current scene page. The video will be positioned and sized
|
|
4845
|
+
* according to the provided parameters. Timeline and animation effects can be applied.
|
|
4846
|
+
* Only works in Video mode, not in Design mode.
|
|
4847
|
+
*
|
|
4848
|
+
* @param url - URL or path to the video file
|
|
4849
|
+
* @param width - Width of the video in scene design units
|
|
4850
|
+
* @param height - Height of the video in scene design units
|
|
4851
|
+
* @param options - Configuration options for the video
|
|
4852
|
+
* @returns Promise that resolves to the ID of the created video block
|
|
4853
|
+
* @throws Error if called in Design mode or if no current page exists
|
|
4854
|
+
*/
|
|
4855
|
+
addVideo(url: string, width: number, height: number, options?: AddVideoOptions): Promise<DesignBlockId>;
|
|
4856
|
+
/**
|
|
4857
|
+
* Applies an animation to a block.
|
|
4858
|
+
*
|
|
4859
|
+
* @param block - The ID of the block to apply the animation to
|
|
4860
|
+
* @param animation - The animation configuration options
|
|
4861
|
+
*/
|
|
4862
|
+
applyAnimation(block: DesignBlockId, animation?: AnimationOptions): void;
|
|
4863
|
+
/**
|
|
4864
|
+
* Applies a drop shadow effect to any block.
|
|
4865
|
+
*
|
|
4866
|
+
* @param block - The ID of the block to apply the shadow to
|
|
4867
|
+
* @param options - Shadow configuration options. If not provided, enables shadow with default settings
|
|
4868
|
+
*/
|
|
4869
|
+
applyDropShadow(block: DesignBlockId, options?: DropShadowOptions): void;
|
|
4870
|
+
/**
|
|
4871
|
+
* Generates a thumbnail image of the scene at a specific time.
|
|
4872
|
+
* Only works in Video mode, not in Design mode.
|
|
4873
|
+
*
|
|
4874
|
+
* @param height - Height of the thumbnail in scene design units (maximum 512)
|
|
4875
|
+
* @param time - Time position in seconds to capture the thumbnail
|
|
4876
|
+
* @returns Promise that resolves to a Blob containing the PNG thumbnail image
|
|
4877
|
+
* @throws Error if no page exists, if called in Design mode, or if height exceeds 512 pixels
|
|
4878
|
+
*/
|
|
4879
|
+
generateThumbnailAtTimeOffset(height: number, time: number): Promise<Blob>;
|
|
4880
|
+
/**
|
|
4881
|
+
* Gets the background track of the current scene.
|
|
4882
|
+
* The background track is the track that determines the page duration.
|
|
4883
|
+
* Only works in Video mode, not in Design mode.
|
|
4884
|
+
*
|
|
4885
|
+
* @returns The ID of the background track, or null if none exists
|
|
4886
|
+
* @throws Error if called in Design mode
|
|
4887
|
+
*/
|
|
4888
|
+
getBackgroundTrack(): DesignBlockId | null;
|
|
4889
|
+
/**
|
|
4890
|
+
* Moves a block to the background track.
|
|
4891
|
+
* This is useful for organizing content in video scenes where you want
|
|
4892
|
+
* certain elements to be part of the background layer.
|
|
4893
|
+
* The background track is the track that determines the page duration.
|
|
4894
|
+
*
|
|
4895
|
+
* @param block - The ID of the block to move to the background track
|
|
4896
|
+
* @throws Error if no background track is found
|
|
4897
|
+
*/
|
|
4898
|
+
moveToBackgroundTrack(block: DesignBlockId): void;
|
|
4254
4899
|
}
|
|
4255
4900
|
|
|
4256
4901
|
/** @public */
|
|
@@ -4448,6 +5093,23 @@ export declare interface Configuration {
|
|
|
4448
5093
|
*/
|
|
4449
5094
|
export declare type ContentFillMode = 'Crop' | 'Cover' | 'Contain';
|
|
4450
5095
|
|
|
5096
|
+
/**
|
|
5097
|
+
* Options for creating a video scene.
|
|
5098
|
+
* @public
|
|
5099
|
+
*/
|
|
5100
|
+
export declare type CreateSceneOptions = {
|
|
5101
|
+
/** The page options */
|
|
5102
|
+
page: {
|
|
5103
|
+
/** The size of the page */
|
|
5104
|
+
size: number | {
|
|
5105
|
+
width: number;
|
|
5106
|
+
height: number;
|
|
5107
|
+
};
|
|
5108
|
+
/** The background color of the page */
|
|
5109
|
+
color?: Color;
|
|
5110
|
+
};
|
|
5111
|
+
};
|
|
5112
|
+
|
|
4451
5113
|
/**
|
|
4452
5114
|
* The CreativeEngine is the core processing unit of CE.SDK and handles state management, rendering, input handling, and much more.
|
|
4453
5115
|
* It provides APIs to directly interact with assets, blocks, scenes, and variables. These APIs can be used in a headless environment
|
|
@@ -4704,6 +5366,29 @@ export declare type DesignBlockTypeShorthand = 'scene' | 'stack' | 'camera' | 'p
|
|
|
4704
5366
|
*/
|
|
4705
5367
|
export declare type DesignUnit = 'Pixel' | 'Millimeter' | 'Inch';
|
|
4706
5368
|
|
|
5369
|
+
/**
|
|
5370
|
+
* Options for configuring drop shadow effects on blocks.
|
|
5371
|
+
* @public
|
|
5372
|
+
*/
|
|
5373
|
+
export declare type DropShadowOptions = {
|
|
5374
|
+
/** The color of the drop shadow */
|
|
5375
|
+
color?: Color;
|
|
5376
|
+
/** The offset position of the shadow */
|
|
5377
|
+
offset?: {
|
|
5378
|
+
/** Horizontal offset in scene design units */
|
|
5379
|
+
x?: number;
|
|
5380
|
+
/** Vertical offset in scene design units */
|
|
5381
|
+
y?: number;
|
|
5382
|
+
};
|
|
5383
|
+
/** The blur radius of the shadow */
|
|
5384
|
+
blur?: {
|
|
5385
|
+
/** Horizontal blur radius in scene design units */
|
|
5386
|
+
x?: number;
|
|
5387
|
+
/** Vertical blur radius in scene design units */
|
|
5388
|
+
y?: number;
|
|
5389
|
+
};
|
|
5390
|
+
};
|
|
5391
|
+
|
|
4707
5392
|
/** @public */
|
|
4708
5393
|
export declare type EditMode = 'Transform' | 'Crop' | 'Text' | 'Playback' | 'Trim' | (string & {});
|
|
4709
5394
|
|
|
@@ -4820,6 +5505,10 @@ export declare class EditorAPI {
|
|
|
4820
5505
|
*
|
|
4821
5506
|
* Multiple histories can exist, but only one can be active at a time.
|
|
4822
5507
|
*
|
|
5508
|
+
* ```javascript
|
|
5509
|
+
* const newHistory = engine.editor.createHistory();
|
|
5510
|
+
* ```
|
|
5511
|
+
*
|
|
4823
5512
|
* @category History Management
|
|
4824
5513
|
* @returns The handle of the created history.
|
|
4825
5514
|
*/
|
|
@@ -4827,6 +5516,10 @@ export declare class EditorAPI {
|
|
|
4827
5516
|
/**
|
|
4828
5517
|
* Destroy a history stack and free its resources.
|
|
4829
5518
|
*
|
|
5519
|
+
* ```javascript
|
|
5520
|
+
* engine.editor.destroyHistory(oldHistory);
|
|
5521
|
+
* ```
|
|
5522
|
+
*
|
|
4830
5523
|
* @category History Management
|
|
4831
5524
|
* @param history - The history handle to destroy.
|
|
4832
5525
|
* @throws Error if the handle doesn't refer to a valid history.
|
|
@@ -4837,6 +5530,10 @@ export declare class EditorAPI {
|
|
|
4837
5530
|
*
|
|
4838
5531
|
* All other histories lose their active state. Undo/redo operations only apply to the active history.
|
|
4839
5532
|
*
|
|
5533
|
+
* ```javascript
|
|
5534
|
+
* engine.editor.setActiveHistory(newHistory);
|
|
5535
|
+
* ```
|
|
5536
|
+
*
|
|
4840
5537
|
* @category History Management
|
|
4841
5538
|
* @param history - The history handle to make active.
|
|
4842
5539
|
* @throws Error if the handle doesn't refer to a valid history.
|
|
@@ -4847,6 +5544,10 @@ export declare class EditorAPI {
|
|
|
4847
5544
|
*
|
|
4848
5545
|
* Creates a new history if none exists.
|
|
4849
5546
|
*
|
|
5547
|
+
* ```javascript
|
|
5548
|
+
* const oldHistory = engine.editor.getActiveHistory();
|
|
5549
|
+
* ```
|
|
5550
|
+
*
|
|
4850
5551
|
* @category History Management
|
|
4851
5552
|
* @returns The handle of the active history.
|
|
4852
5553
|
*/
|
|
@@ -4856,17 +5557,29 @@ export declare class EditorAPI {
|
|
|
4856
5557
|
*
|
|
4857
5558
|
* Only adds a state if undoable changes were made since the last undo step.
|
|
4858
5559
|
*
|
|
5560
|
+
* ```javascript
|
|
5561
|
+
* engine.editor.addUndoStep();
|
|
5562
|
+
* ```
|
|
5563
|
+
*
|
|
4859
5564
|
* @category History Management
|
|
4860
5565
|
*/
|
|
4861
5566
|
addUndoStep(): void;
|
|
4862
5567
|
/**
|
|
4863
|
-
* Undo one step in the active history.
|
|
5568
|
+
* Undo one step in the active history if an undo step is available.
|
|
5569
|
+
*
|
|
5570
|
+
* ```javascript
|
|
5571
|
+
* engine.editor.undo();
|
|
5572
|
+
* ```
|
|
4864
5573
|
*
|
|
4865
5574
|
* @category History Management
|
|
4866
5575
|
*/
|
|
4867
5576
|
undo(): void;
|
|
4868
5577
|
/**
|
|
4869
|
-
* Redo one step in the active history.
|
|
5578
|
+
* Redo one step in the active history if a redo step is available.
|
|
5579
|
+
*
|
|
5580
|
+
* ```javascript
|
|
5581
|
+
* engine.editor.redo();
|
|
5582
|
+
* ```
|
|
4870
5583
|
*
|
|
4871
5584
|
* @category History Management
|
|
4872
5585
|
*/
|
|
@@ -4874,6 +5587,12 @@ export declare class EditorAPI {
|
|
|
4874
5587
|
/**
|
|
4875
5588
|
* Check if an undo step is available.
|
|
4876
5589
|
*
|
|
5590
|
+
* ```javascript
|
|
5591
|
+
* if (engine.editor.canUndo()) {
|
|
5592
|
+
* engine.editor.undo();
|
|
5593
|
+
* }
|
|
5594
|
+
* ```
|
|
5595
|
+
*
|
|
4877
5596
|
* @category History Management
|
|
4878
5597
|
* @returns True if an undo step is available.
|
|
4879
5598
|
*/
|
|
@@ -4881,6 +5600,12 @@ export declare class EditorAPI {
|
|
|
4881
5600
|
/**
|
|
4882
5601
|
* Check if a redo step is available.
|
|
4883
5602
|
*
|
|
5603
|
+
* ```javascript
|
|
5604
|
+
* if (engine.editor.canRedo()) {
|
|
5605
|
+
* engine.editor.redo();
|
|
5606
|
+
* }
|
|
5607
|
+
* ```
|
|
5608
|
+
*
|
|
4884
5609
|
* @category History Management
|
|
4885
5610
|
* @returns True if a redo step is available.
|
|
4886
5611
|
*/
|
|
@@ -4888,6 +5613,14 @@ export declare class EditorAPI {
|
|
|
4888
5613
|
/**
|
|
4889
5614
|
* Subscribe to undo/redo history changes.
|
|
4890
5615
|
*
|
|
5616
|
+
* ```javascript
|
|
5617
|
+
* const unsubscribe = engine.editor.onHistoryUpdated(() => {
|
|
5618
|
+
* const canUndo = engine.editor.canUndo();
|
|
5619
|
+
* const canRedo = engine.editor.canRedo();
|
|
5620
|
+
* console.log("History updated", {canUndo, canRedo});
|
|
5621
|
+
* })
|
|
5622
|
+
* ```
|
|
5623
|
+
*
|
|
4891
5624
|
* @category Event Subscriptions
|
|
4892
5625
|
* @param callback - Function called when the undo/redo history changes.
|
|
4893
5626
|
* @returns A method to unsubscribe from the event.
|
|
@@ -5120,7 +5853,19 @@ export declare class EditorAPI {
|
|
|
5120
5853
|
*
|
|
5121
5854
|
* This function can be called more than once. Subsequent calls will overwrite previous calls.
|
|
5122
5855
|
* To remove a previously set resolver, pass the value `null`.
|
|
5123
|
-
* The given function must return an absolute path with a scheme. The input is allowed to be invalid URI, e.g., due to placeholders.
|
|
5856
|
+
* The given function must return an absolute path with a scheme and cannot be asynchronous. The input is allowed to be invalid URI, e.g., due to placeholders.
|
|
5857
|
+
*
|
|
5858
|
+
* ```javascript
|
|
5859
|
+
* // Replace all .jpg files with the IMG.LY logo
|
|
5860
|
+
* engine.editor.setURIResolver((uri) => {
|
|
5861
|
+
* if (uri.endsWith('.jpg')) {
|
|
5862
|
+
* return 'https://img.ly/static/ubq_samples/imgly_logo.jpg';
|
|
5863
|
+
* }
|
|
5864
|
+
* // Make use of the default URI resolution behavior.
|
|
5865
|
+
* return engine.editor.defaultURIResolver(uri);
|
|
5866
|
+
* });
|
|
5867
|
+
* ```
|
|
5868
|
+
*
|
|
5124
5869
|
* @category Editor Settings
|
|
5125
5870
|
* @param resolver - Custom resolution function. The resolution function
|
|
5126
5871
|
* should not reference variables outside of its scope.
|
|
@@ -5132,6 +5877,11 @@ export declare class EditorAPI {
|
|
|
5132
5877
|
* This is the default implementation for the URI resolver.
|
|
5133
5878
|
*
|
|
5134
5879
|
* It resolves the given path relative to the `basePath` setting.
|
|
5880
|
+
*
|
|
5881
|
+
* ```javascript
|
|
5882
|
+
* engine.editor.defaultURIResolver(uri);
|
|
5883
|
+
* ```
|
|
5884
|
+
*
|
|
5135
5885
|
* @category Editor Settings
|
|
5136
5886
|
* @param relativePath - The relative path that should be resolved.
|
|
5137
5887
|
* @returns The resolved absolute URI.
|
|
@@ -5143,6 +5893,7 @@ export declare class EditorAPI {
|
|
|
5143
5893
|
* If a custom resolver has been set with `setURIResolver`, it invokes it with the given path.
|
|
5144
5894
|
* Else, it resolves it as relative to the `basePath` setting.
|
|
5145
5895
|
* This performs NO validation of whether a file exists at the specified location.
|
|
5896
|
+
*
|
|
5146
5897
|
* @category Editor Settings
|
|
5147
5898
|
* @param relativePath - A relative path string
|
|
5148
5899
|
* @returns The resolved absolute uri or an error if an invalid path was given.
|
|
@@ -5259,6 +6010,13 @@ export declare class EditorAPI {
|
|
|
5259
6010
|
/**
|
|
5260
6011
|
* Create a resizable buffer for arbitrary data.
|
|
5261
6012
|
*
|
|
6013
|
+
* ```javascript
|
|
6014
|
+
* const buffer = engine.editor.createBuffer();
|
|
6015
|
+
*
|
|
6016
|
+
* // Reference the buffer resource from the audio block
|
|
6017
|
+
* engine.block.setString(audioBlock, 'audio/fileURI', buffer);
|
|
6018
|
+
* ```
|
|
6019
|
+
*
|
|
5262
6020
|
* @category Resource Management
|
|
5263
6021
|
* @returns A URI to identify the created buffer.
|
|
5264
6022
|
*/
|
|
@@ -5266,6 +6024,10 @@ export declare class EditorAPI {
|
|
|
5266
6024
|
/**
|
|
5267
6025
|
* Destroy a buffer and free its resources.
|
|
5268
6026
|
*
|
|
6027
|
+
* ```javascript
|
|
6028
|
+
* engine.editor.destroyBuffer(buffer);
|
|
6029
|
+
* ```
|
|
6030
|
+
*
|
|
5269
6031
|
* @category Resource Management
|
|
5270
6032
|
* @param uri - The URI of the buffer to destroy.
|
|
5271
6033
|
*/
|
|
@@ -5273,6 +6035,16 @@ export declare class EditorAPI {
|
|
|
5273
6035
|
/**
|
|
5274
6036
|
* Set the data of a buffer at a given offset.
|
|
5275
6037
|
*
|
|
6038
|
+
* ```javascript
|
|
6039
|
+
* // Generate 10 seconds of stereo 48 kHz audio data
|
|
6040
|
+
* const samples = new Float32Array(10 * 2 * 48000);
|
|
6041
|
+
* for (let i = 0; i < samples.length; i += 2) {
|
|
6042
|
+
* samples[i] = samples[i + 1] = Math.sin((440 * i * Math.PI) / 48000);
|
|
6043
|
+
* }
|
|
6044
|
+
* // Assign the audio data to the buffer
|
|
6045
|
+
* engine.editor.setBufferData(buffer, 0, new Uint8Array(samples.buffer));
|
|
6046
|
+
* ```
|
|
6047
|
+
*
|
|
5276
6048
|
* @category Resource Management
|
|
5277
6049
|
* @param uri - The URI of the buffer to update.
|
|
5278
6050
|
* @param offset - The offset in bytes at which to start writing.
|
|
@@ -5282,6 +6054,15 @@ export declare class EditorAPI {
|
|
|
5282
6054
|
/**
|
|
5283
6055
|
* Get the data of a buffer at a given offset.
|
|
5284
6056
|
*
|
|
6057
|
+
* ```javascript
|
|
6058
|
+
* engine.editor.findAllTransientResources().forEach((resource) => {
|
|
6059
|
+
* const bufferURI = resource.url;
|
|
6060
|
+
* const length = engine.editor.getBufferLength(buffer);
|
|
6061
|
+
* const data = engine.editor.getBufferData(buffer, 0, length);
|
|
6062
|
+
* const blob = new Blob([data]);
|
|
6063
|
+
* })
|
|
6064
|
+
* ```
|
|
6065
|
+
*
|
|
5285
6066
|
* @category Resource Management
|
|
5286
6067
|
* @param uri - The URI of the buffer to query.
|
|
5287
6068
|
* @param offset - The offset in bytes at which to start reading.
|
|
@@ -5292,6 +6073,12 @@ export declare class EditorAPI {
|
|
|
5292
6073
|
/**
|
|
5293
6074
|
* Set the length of a buffer.
|
|
5294
6075
|
*
|
|
6076
|
+
* ```javascript
|
|
6077
|
+
* // Reduce the buffer to half its length
|
|
6078
|
+
* const currentLength = engine.editor.getBufferLength(buffer);
|
|
6079
|
+
* engine.editor.setBufferLength(buffer, currentLength / 2);
|
|
6080
|
+
* ```
|
|
6081
|
+
*
|
|
5295
6082
|
* @category Resource Management
|
|
5296
6083
|
* @param uri - The URI of the buffer to update.
|
|
5297
6084
|
* @param length - The new length of the buffer in bytes.
|
|
@@ -5300,6 +6087,10 @@ export declare class EditorAPI {
|
|
|
5300
6087
|
/**
|
|
5301
6088
|
* Get the length of a buffer.
|
|
5302
6089
|
*
|
|
6090
|
+
* ```javascript
|
|
6091
|
+
* const length = engine.editor.getBufferLength(buffer);
|
|
6092
|
+
* ```
|
|
6093
|
+
*
|
|
5303
6094
|
* @category Resource Management
|
|
5304
6095
|
* @param uri - The URI of the buffer to query.
|
|
5305
6096
|
* @returns The length of the buffer in bytes.
|
|
@@ -5349,12 +6140,22 @@ export declare class EditorAPI {
|
|
|
5349
6140
|
relocateResource(currentUrl: string, relocatedUrl: string): void;
|
|
5350
6141
|
/**
|
|
5351
6142
|
* Checks wether the block has selection and hover highlighting enabled or disabled.
|
|
6143
|
+
*
|
|
6144
|
+
* ```javascript
|
|
6145
|
+
* const highlightingIsEnabled = engine.editor.isHighlightingEnabled(block);
|
|
6146
|
+
* ```
|
|
6147
|
+
*
|
|
5352
6148
|
* @param id - The block to query.
|
|
5353
6149
|
* @returns True if highlighting is enabled, false otherwise.
|
|
5354
6150
|
*/
|
|
5355
6151
|
isHighlightingEnabled(id: DesignBlockId): boolean;
|
|
5356
6152
|
/**
|
|
5357
6153
|
* Enable or disable selection and hover highlighting for a block.
|
|
6154
|
+
*
|
|
6155
|
+
* ```javascript
|
|
6156
|
+
* engine.editor.setHighlightingEnabled(block, true);
|
|
6157
|
+
* ```
|
|
6158
|
+
*
|
|
5358
6159
|
* @param id - The block to update.
|
|
5359
6160
|
* @param enabled - Whether or not the block should show highlighting when selected or hovered.
|
|
5360
6161
|
*/
|
|
@@ -6022,9 +6823,14 @@ export declare class SceneAPI {
|
|
|
6022
6823
|
* ```
|
|
6023
6824
|
*
|
|
6024
6825
|
* @category Scene Creation
|
|
6826
|
+
* @param sceneLayout - The layout of the scene.
|
|
6827
|
+
* @param options - Optional parameters for the scene. Properties:
|
|
6828
|
+
* - `page` - Page options. Properties:
|
|
6829
|
+
* - `size` - The size of the page.
|
|
6830
|
+
* - `color` - Optional background color of the page.
|
|
6025
6831
|
* @returns The scene's handle.
|
|
6026
6832
|
*/
|
|
6027
|
-
create(sceneLayout?: SceneLayout): DesignBlockId;
|
|
6833
|
+
create(sceneLayout?: SceneLayout, options?: CreateSceneOptions): DesignBlockId;
|
|
6028
6834
|
/**
|
|
6029
6835
|
* Create a new scene in video mode, along with its own camera.
|
|
6030
6836
|
*
|
|
@@ -6033,9 +6839,13 @@ export declare class SceneAPI {
|
|
|
6033
6839
|
* ```
|
|
6034
6840
|
*
|
|
6035
6841
|
* @category Scene Creation
|
|
6842
|
+
* @param options - Optional parameters for the scene. Properties:
|
|
6843
|
+
* - `page` - Page options. Properties:
|
|
6844
|
+
* - `size` - The size of the page.
|
|
6845
|
+
* - `color` - Optional background color of the page.
|
|
6036
6846
|
* @returns The scene's handle.
|
|
6037
6847
|
*/
|
|
6038
|
-
createVideo(): DesignBlockId;
|
|
6848
|
+
createVideo(options?: CreateSceneOptions): DesignBlockId;
|
|
6039
6849
|
/**
|
|
6040
6850
|
* Loads the given image and creates a scene with a single page showing the image.
|
|
6041
6851
|
*
|
|
@@ -6224,6 +7034,16 @@ export declare class SceneAPI {
|
|
|
6224
7034
|
* @returns The zoom level of the block's camera.
|
|
6225
7035
|
*/
|
|
6226
7036
|
getZoomLevel(): number;
|
|
7037
|
+
/**
|
|
7038
|
+
* Sets the zoom and focus to show a block, optionally with animation.
|
|
7039
|
+
* This only shows an effect if the zoom level is not handled/overwritten by the UI.
|
|
7040
|
+
* Without padding, this results in a tight view on the block.
|
|
7041
|
+
*
|
|
7042
|
+
* @param id - The block that should be focused on.
|
|
7043
|
+
* @param options - Configuration for padding and animation.
|
|
7044
|
+
* @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
|
|
7045
|
+
*/
|
|
7046
|
+
zoomToBlock(id: DesignBlockId, options?: ZoomOptions): Promise<void>;
|
|
6227
7047
|
/**
|
|
6228
7048
|
* Sets the zoom and focus to show a block.
|
|
6229
7049
|
*
|
|
@@ -6242,6 +7062,7 @@ export declare class SceneAPI {
|
|
|
6242
7062
|
* @param paddingRight - Optional padding in screen pixels to the right of the block.
|
|
6243
7063
|
* @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
|
|
6244
7064
|
* @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
|
|
7065
|
+
* @deprecated Use zoomToBlock with options object instead
|
|
6245
7066
|
*/
|
|
6246
7067
|
zoomToBlock(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>;
|
|
6247
7068
|
/**
|
|
@@ -6432,6 +7253,14 @@ export declare class SceneAPI {
|
|
|
6432
7253
|
* @returns A method to unsubscribe.
|
|
6433
7254
|
*/
|
|
6434
7255
|
onActiveChanged: (callback: () => void) => (() => void);
|
|
7256
|
+
/**
|
|
7257
|
+
* Starts or stops playback of the current scene.
|
|
7258
|
+
* Only works in Video mode, not in Design mode.
|
|
7259
|
+
*
|
|
7260
|
+
* @param play - True to start playback, false to stop
|
|
7261
|
+
* @throws Error if no page is available for playback
|
|
7262
|
+
*/
|
|
7263
|
+
setPlaying(play: boolean): void;
|
|
6435
7264
|
}
|
|
6436
7265
|
|
|
6437
7266
|
/**
|
|
@@ -6790,4 +7619,30 @@ export declare type XYWH = [x: number, y: number, w: number, h: number];
|
|
|
6790
7619
|
*/
|
|
6791
7620
|
export declare type ZoomAutoFitAxis = 'Horizontal' | 'Vertical' | 'Both';
|
|
6792
7621
|
|
|
7622
|
+
/**
|
|
7623
|
+
* Options for zooming to a block with optional animation.
|
|
7624
|
+
* @public
|
|
7625
|
+
*/
|
|
7626
|
+
export declare type ZoomOptions = {
|
|
7627
|
+
/** Padding configuration around the block */
|
|
7628
|
+
padding?: number | {
|
|
7629
|
+
x?: number;
|
|
7630
|
+
y?: number;
|
|
7631
|
+
} | {
|
|
7632
|
+
top?: number;
|
|
7633
|
+
bottom?: number;
|
|
7634
|
+
left?: number;
|
|
7635
|
+
right?: number;
|
|
7636
|
+
};
|
|
7637
|
+
/** Animation configuration - boolean for default animation or object for custom settings */
|
|
7638
|
+
animate?: boolean | {
|
|
7639
|
+
/** Duration of the animation in seconds */
|
|
7640
|
+
duration?: number;
|
|
7641
|
+
/** Easing function for the animation */
|
|
7642
|
+
easing?: AnimationEasing;
|
|
7643
|
+
/** Whether the animation can be interrupted */
|
|
7644
|
+
interruptible?: boolean;
|
|
7645
|
+
};
|
|
7646
|
+
};
|
|
7647
|
+
|
|
6793
7648
|
export { }
|