deepar 5.3.1-selfieSegmentation-alpha-5 → 5.4.0-canvasInDiv-alpha-13

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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Function that needs to be called before every render.
3
+ */
4
+ declare const preRenderUpdate: () => void;
5
+ /**
6
+ * Function that needs to be called after every render.
7
+ */
8
+ declare const postRenderUpdate: () => void;
9
+ /**
10
+ * Creates a canvas and appends it to the target element.
11
+ * @param targetElement
12
+ */
13
+ declare function createCanvas(targetElement: HTMLElement): HTMLCanvasElement;
14
+ /**
15
+ * Removes the created canvas and invalidates the current context.
16
+ */
17
+ declare function invalidate(): void;
18
+ export { preRenderUpdate, postRenderUpdate, createCanvas, invalidate };
@@ -4,6 +4,7 @@ export * from './initParams';
4
4
  export * from './callbacks';
5
5
  export * from './faceData';
6
6
  export * from './footData';
7
+ export * from './wristData';
7
8
  export * from './scriptingApi';
8
9
  export * as errors from './errors';
9
10
  export * from './touchType';
@@ -7,9 +7,20 @@ export interface DeepARParams {
7
7
  */
8
8
  licenseKey: string;
9
9
  /**
10
- * Canvas element where DeepAR will render the camera and effects/filters.
10
+ * Target HTML element where AR preview will be presented.
11
+ *
12
+ * > ⚠️ You must specify {@link targetElement} or {@link canvas}.
13
+ *
14
+ * This is usually a <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div">div</a> element which
15
+ * is used solely for AR preview. AR preview will fully occupy the targetElement's space.
16
+ * Therefore, position and size your targetElement according to your preferred AR preview dimensions.
17
+ *
18
+ * > NOTE: AR preview will adjust to the size of the targetElement if it changes.
19
+ *
20
+ * The canvas element will be appended as child to the targetElement. If you wish to work with the canvas element directly
21
+ * and position and size it yourself then use {@link canvas} parameter instead.
11
22
  */
12
- canvas: HTMLCanvasElement;
23
+ targetElement?: HTMLElement;
13
24
  /**
14
25
  * The URL of a DeepAR effect file. This effect will be applied when DeepAR is initialized.
15
26
  * This parameter is optional. You can always later switch to a different effect with {@link DeepAR.switchEffect}.
@@ -28,6 +39,30 @@ export interface DeepARParams {
28
39
  * To configure usage of non-default ML models, define them in the {@link additionalOptions}.
29
40
  */
30
41
  rootPath?: string;
42
+ /**
43
+ * Canvas element where DeepAR will render the AR preview.
44
+ *
45
+ * > ⚠️ You must specify {@link targetElement} or {@link canvas}.
46
+ *
47
+ * The preferred way is by using the {@link targetElement} parameter.
48
+ * In that case, the DeepAR will take care of correctly sizing the canvas.
49
+ *
50
+ * @example
51
+ * ```javascript
52
+ * const canvas = document.createElement('canvas')
53
+ * canvas.style.display = 'block'
54
+ *
55
+ * // We want to fill the whole screen.
56
+ * const width = window.innerWidth
57
+ * const height = window.innerHeight
58
+ * const dpr = window.devicePixelRatio || 1
59
+ * canvas.width = width * dpr
60
+ * canvas.height = height * dpr
61
+ * canvas.style.width = `${width}px`
62
+ * canvas.style.height = `${height}px`
63
+ * ```
64
+ */
65
+ canvas?: HTMLCanvasElement;
31
66
  /**
32
67
  * Additional DeepAR options.
33
68
  */
@@ -81,11 +116,7 @@ export interface DeepARParams {
81
116
  /**
82
117
  * Path to the segmentation model. Something like "path/to/deepar/models/segmentation/segmentation-192x192.bin".
83
118
  */
84
- modelPath?: string;
85
- mediaPipeConfig?: {
86
- wasmBasePath?: string;
87
- modelPath?: string;
88
- };
119
+ modelPath: string;
89
120
  };
90
121
  /**
91
122
  * Foot tracking module paths and options.
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * DeepAR Web SDK version.
3
3
  */
4
- declare const version = "5.3.1-selfieSegmentation-alpha-5";
4
+ declare const version = "5.4.0-canvasInDiv-alpha-13";
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepar",
3
- "version": "5.3.1-selfieSegmentation-alpha-5",
3
+ "version": "5.4.0-canvasInDiv-alpha-13",
4
4
  "description": "The official DeepAR Web SDK",
5
5
  "main": "js/deepar.esm.js",
6
6
  "jsdelivr": "js/deepar.js",
package/wasm/deepar.wasm CHANGED
Binary file