HTML Canvas Reference

By Xah Lee. Date: . Last updated: .

Here is a complete list of JavaScript methods of HTML Canvas.

Rectangle

rect()
fillRect()
strokeRect()
clearRect()

Path

fill()
stroke()
beginPath()
moveTo()
closePath()
lineTo()
clip()
quadraticCurveTo()
bezierCurveTo()
arc()
arcTo()
isPointInPath()

Path Styles

lineCap
lineJoin
lineWidth
miterLimit

Transformations

scale()
rotate()
translate()
transform()
setTransform()

Text

fillText()
strokeText()
measureText()
font
textAlign
textBaseline

Image Drawing

drawImage()

Pixel Manipulation

width
height
data
createImageData()
getImageData()
putImageData()

Compositing

globalAlpha
globalCompositeOperation

Style and Patterns

fillStyle
strokeStyle
shadowColor
shadowBlur
shadowOffsetX
shadowOffsetY
createLinearGradient()
createPattern()
createRadialGradient()
addColorStop()

Other

save()
restore()

SVG tutorial

Canvas Intro

JS in Depth
XAH  BUY NOW