@rive-app/webgl-single 1.1.10 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rive.d.ts +0 -5
- package/rive.js +2 -9
- package/rive.js.map +1 -1
- package/rive_advanced.mjs.d.ts +26 -4
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -45,12 +45,12 @@ export interface RiveCanvas {
|
|
|
45
45
|
* This uses an offscreen renderer to draw on the canvas, allowing for multiple Rives/canvases on
|
|
46
46
|
* a given screen. It is highly recommended to set this to `true` when using with the
|
|
47
47
|
* `@rive-app/webgl` package
|
|
48
|
-
* @returns A Rive CanvasRenderer class
|
|
48
|
+
* @returns A Rive CanvasRenderer (Canvas2D) or Renderer (WebGL) class
|
|
49
49
|
*/
|
|
50
50
|
makeRenderer(
|
|
51
51
|
canvas: HTMLCanvasElement | OffscreenCanvas,
|
|
52
52
|
useOffscreenRenderer?: boolean
|
|
53
|
-
): CanvasRenderer;
|
|
53
|
+
): CanvasRenderer | Renderer;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Computes how the Rive is laid out onto the canvas
|
|
@@ -133,7 +133,8 @@ export declare class RendererWrapper {
|
|
|
133
133
|
drawPath(path: RenderPath, paint: RenderPaint): void;
|
|
134
134
|
clipPath(path: RenderPath): void;
|
|
135
135
|
/**
|
|
136
|
-
* Calls the context's clearRect() function to clear the entire canvas
|
|
136
|
+
* Calls the context's clearRect() function to clear the entire canvas. Crucial to call
|
|
137
|
+
* this at the start of the render loop to clear the canvas before drawing the next frame
|
|
137
138
|
*
|
|
138
139
|
* For the underlying API, check
|
|
139
140
|
* https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clearRect
|
|
@@ -202,6 +203,27 @@ export declare class CanvasRenderer extends Renderer {
|
|
|
202
203
|
constructor(
|
|
203
204
|
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D
|
|
204
205
|
);
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Canvas2D API for drawing an image onto a canvas
|
|
209
|
+
*/
|
|
210
|
+
drawImage: (
|
|
211
|
+
image:
|
|
212
|
+
| HTMLImageElement
|
|
213
|
+
| SVGImageElement
|
|
214
|
+
| HTMLVideoElement
|
|
215
|
+
| HTMLCanvasElement
|
|
216
|
+
| ImageBitmap
|
|
217
|
+
| OffscreenCanvas,
|
|
218
|
+
sx?: number,
|
|
219
|
+
sy?: number,
|
|
220
|
+
sWidth?: number,
|
|
221
|
+
sHeight?: number,
|
|
222
|
+
dx?: number,
|
|
223
|
+
dy?: number,
|
|
224
|
+
dWidth?: number,
|
|
225
|
+
dHeight?: number
|
|
226
|
+
) => void;
|
|
205
227
|
}
|
|
206
228
|
|
|
207
229
|
export declare class CanvasRenderPaint extends RenderPaint {
|
|
@@ -286,7 +308,7 @@ export declare class Artboard {
|
|
|
286
308
|
* Draws the artboard with a given rendering context.
|
|
287
309
|
* @param renderer - Renderer context to draw with
|
|
288
310
|
*/
|
|
289
|
-
draw(renderer: CanvasRenderer): void;
|
|
311
|
+
draw(renderer: CanvasRenderer | Renderer): void;
|
|
290
312
|
/**
|
|
291
313
|
* Creates a LinearAnimation for the animation with the given name
|
|
292
314
|
*
|