Top "Canvas" questions

Canvas is a generic term for the drawing surface used with many free-form graphics output APIs.

Controlling fps with requestAnimationFrame?

It seems like requestAnimationFrame is the de facto way to animate things now. It worked pretty well for me for …

javascript performance animation canvas requestanimationframe
Centering a canvas

How do I markup a page with an HTML5 canvas such that the canvas Takes up 80% of the width Has …

css html canvas
Get distance between two points in canvas

I have canvas drawing tab and want lineWidth to be based on distance between two last mousemove coordinate updates. I …

javascript canvas
How to Copy Contents of One Canvas to Another Canvas Locally

I'd like to copy ALL contents of one canvas and transfer them to another all on the client-side. I would …

html canvas
What's the best way to set a single pixel in an HTML5 canvas?

The HTML5 Canvas has no method for explicitly setting a single pixel. It might be possible to set a pixel …

html canvas pixel
how to draw smooth curve through N points using javascript HTML5 canvas?

For a drawing application, I'm saving the mouse movement coordinates to an array then drawing them with lineTo. The resulting …

javascript canvas html5-canvas bezier spline
Convert canvas to PDF

Is it possible to directly convert canvas to pdf using JavaScript (pdf.js or something like that)? Is there another …

javascript canvas pdf-generation
How can you find the height of text on an HTML canvas?

The spec has a context.measureText(text) function that will tell you how much width it would require to print …

javascript text canvas
HTML5 Canvas and Anti-aliasing

How to turn on the anti-aliasing on an canvas. The following code doesn't draw a smooth line: var context = mainCanv.…

html canvas antialiasing
Get pixel color from canvas, on mousemove

Is it possible to get the RGB value pixel under the mouse? Is there a complete example of this? Here's …

javascript html jquery canvas getimagedata