mirror of
https://github.com/adriancooney/console.snapshot.git
synced 2025-12-08 21:26:19 +00:00
30 lines
1.0 KiB
Markdown
30 lines
1.0 KiB
Markdown
# console.snapshot( _canvas_ )
|
|
### Snapshot a canvas and output it to the console.
|
|
|
|
`console.snapshot` takes and inputted _<canvas>_ element and outputs a snapshot of it into the console. It makes debugging the canvas a little less dramatic. See [this demo](http://dunxrion.github.io/console.snapshot). `console.snapshot` is a fork of the [`console.image`](http://github.com/dunxrion/console.image) and actually does something useful.
|
|
|
|

|
|
|
|
## Usage
|
|
### console.snapshot( _<canvas>_ )
|
|
`console.snapshot` takes in a `HTMLCanvasElement`, base64 encodes it using `toDataURL` and then outputs it to the canvas using `canvas.image`.
|
|
|
|
```js
|
|
var canvas = document.createElement("canvas"),
|
|
ctx = canvas.getContext("2d");
|
|
|
|
// ...
|
|
//draw
|
|
// ...
|
|
|
|
console.snapshot(canvas);
|
|
```
|
|
|
|
### console.image( _<url>_ )
|
|
`console.image` outputs and image from a url into the console. See [console.image](http://github.com/dunxrion/console.image).
|
|
|
|
```js
|
|
console.image("http://i.imgur.com/wWPQK.gif");
|
|
```
|
|
|
|
License: MIT |