canvas-recorder
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -19,4 +19,4 @@ import { BaseRecorder, Settings } from "./shared"; | ||
declare const setup: (action: (context: WebGLRenderingContext) => void) => void; | ||
declare const bootstrap: () => void; | ||
declare const bootstrap: (options?: import("../../../../../Users/roboshoes/Projects/canvas-recorder/src/shared").BoostrapOptions) => void; | ||
export default recorder; | ||
export { getCanvas, getContext, options, start, stop, cleanup, reset, draw, setup, bootstrap }; |
@@ -26,5 +26,5 @@ import JSZip from "jszip"; | ||
declare const draw: (action: (context: CanvasRenderingContext2D, time: number, t: number) => void) => void; | ||
declare const bootstrap: () => void; | ||
declare const bootstrap: (options?: import("../../../../../Users/roboshoes/Projects/canvas-recorder/src/shared").BoostrapOptions) => void; | ||
declare const setup: (action: (context: CanvasRenderingContext2D) => void) => void; | ||
export default recorder; | ||
export { getCanvas, getContext, options, start, stop, cleanup, reset, draw, bootstrap, setup }; |
{ | ||
"name": "canvas-recorder", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Browserside tool to record canvas animations frame by frame.", | ||
@@ -5,0 +5,0 @@ "types": "./", |
@@ -44,3 +44,3 @@ # Canvas Recorder | ||
* [`getContext(): CanvasRenderingContext2D`](#getcontext----canvasrenderingcontext2d) | ||
* [`bootstrap()`](#bootstrap--) | ||
* [`bootstrap( options?: {} )`](#bootstrap--) | ||
* [`Recorder`](#recorder) | ||
@@ -112,6 +112,11 @@ * [`addFrame( canvas: HTMLCanvasElement ): Promise`](#addframe--canvas--htmlcanvaselement----promise) | ||
### `bootstrap()` | ||
### `bootstrap( options? )` | ||
Shorthand for inserting the canvas into the DOM as well as calling `start()`. This is particularly useful | ||
for short sketches. | ||
Bootstrapping allows an options paramter. An object that has a single flag `clear`. Calling | ||
`boostrap( { clear: true } )` will terminate previous sketch and remove the previous canvas from | ||
the DOM. This is helpful when one has an auto-reload with a undefined loop. By default `bootstrap()` | ||
does not clear. | ||
### `Recorder` | ||
@@ -118,0 +123,0 @@ All methods are simply a shorthand for an instance of a `Recorder`. If one would rather instantiate the recorder |
@@ -20,2 +20,8 @@ import JSZip from "jszip"; | ||
/** | ||
* Possible options to be sent to bootstrapping a sketch. | ||
*/ | ||
export interface BoostrapOptions { | ||
clear: boolean; | ||
} | ||
/** | ||
* Abstract base class that implements shared internal functionality to record a canvas was animation frame by frame. | ||
@@ -93,3 +99,3 @@ */ | ||
*/ | ||
bootstrap(): void; | ||
bootstrap(options?: BoostrapOptions): void; | ||
protected abstract clear(): void; | ||
@@ -96,0 +102,0 @@ protected abstract updateCanvas(canvas: HTMLCanvasElement): void; |
@@ -138,3 +138,7 @@ "use strict"; | ||
*/ | ||
bootstrap() { | ||
bootstrap(options = { clear: false }) { | ||
if (options.clear) { | ||
this.stop(); | ||
document.body.innerHTML = ""; | ||
} | ||
document.body.appendChild(this.getCanvas()); | ||
@@ -141,0 +145,0 @@ this.start(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34597
611
249