Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

canvas-recorder

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-recorder - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

1

gl.d.ts

@@ -7,2 +7,3 @@ import { BaseRecorder, Settings } from "./shared";

protected clear(): void;
protected updateCanvas(canvas: HTMLCanvasElement): void;
}

@@ -9,0 +10,0 @@ export declare const recorder: Recorder;

@@ -22,2 +22,6 @@ "use strict";

}
updateCanvas(canvas) {
this.canvas = canvas;
this.context = (canvas.getContext("webgl") || canvas.getContext("experimental-webgl"));
}
}

@@ -24,0 +28,0 @@ exports.Recorder = Recorder;

@@ -6,2 +6,3 @@ import { BaseRecorder, DrawOptions, Settings } from "./shared";

protected clear(): void;
protected updateCanvas(canvas: HTMLCanvasElement): void;
}

@@ -8,0 +9,0 @@ declare const recorder: Recorder;

@@ -15,2 +15,6 @@ "use strict";

}
updateCanvas(canvas) {
this.canvas = canvas;
this.context = canvas.getContext("2d");
}
}

@@ -17,0 +21,0 @@ exports.Recorder = Recorder;

4

package.json
{
"name": "canvas-recorder",
"version": "1.1.0",
"version": "1.2.0",
"description": "Browserside tool to record canvas animations frame by frame.",

@@ -34,4 +34,6 @@ "types": "./",

"devDependencies": {
"@types/a-big-triangle": "^1.0.0",
"@types/expect.js": "^0.3.29",
"@types/file-saver": "^1.3.0",
"@types/gl-shader": "^4.2.0",
"@types/jszip": "^3.1.3",

@@ -38,0 +40,0 @@ "@types/lodash": "^4.14.108",

@@ -29,5 +29,5 @@ # Canvas Recorder

Additionally, `canvas-recorder` can also be used as a command line tool to merge the image sequence into
a MP4 file format.
a MP4 file format. [See here](#cli-tool)
[See here](#cli-tool)
_Note: The package is written in Typescript and ships with types. Use in JS or TS alike._

@@ -52,4 +52,6 @@ ## Methods

- `color`: [Default: `"white"`] Sets the background color of every frame if `clear` is set to `true`.
- `fps`: [Default: `60`] The framerate at from which the elapsed time is calculated in record mode. Not that the
- `fps`: [Default: `60`] The framerate from which the elapsed time is calculated in record mode. Note that the
recording won't happen in at this pace as it is no longer realtime.
- `canvas`: [Default: `HTMLCanvasElement`] Allows to use a specific canvas element for recording instead of creating
an internal one.

@@ -88,2 +90,22 @@ ### `draw( ( context, time ) => {} )`

### `Recorder`
All methods are simply a shorthand for an instance of a `Recorder`. If one would rather instantiate the recorder
themselves, maybe to run multiple recorders at once, do it like so:
```ts
import { Recorder } from "canvas-recorder";
const recorder = new Recorder();
recorder.options( {
...
} );
recorder.draw( ( context: CanvasRenderingContext2D, time: number ) => {
...
} );
recorder.start();
```
## WebGL

@@ -90,0 +112,0 @@

@@ -14,2 +14,3 @@ /// <reference types="jszip" />

fps: number;
canvas?: HTMLCanvasElement;
}

@@ -90,2 +91,3 @@ /**

protected abstract clear(): void;
protected abstract updateCanvas(canvas: HTMLCanvasElement): void;
private init();

@@ -92,0 +94,0 @@ private loop();

@@ -6,5 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const file_saver_1 = require("file-saver");
const jszip_1 = __importDefault(require("jszip"));
const lodash_1 = require("lodash");
const file_saver_1 = require("file-saver");
/**

@@ -44,2 +44,5 @@ * Abstract base class that implements shared internal functionality to record a canvas was animation frame by frame.

}
if (opts.canvas) {
this.updateCanvas(opts.canvas);
}
lodash_1.assign(this.settings, opts);

@@ -46,0 +49,0 @@ this.init();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc