Cheat sheet

  • save()
  • restore()
  • scale(x,y)
  • rotate(angle)
  • translate(x,y)
  • transform(m11,m12,m21,m22,dx,dy)
  • setTransform(m11,m12,m21,m22,dx,dy)
  • globalAlpha=1.0
  • globalCompositeOperation='source-over'
  • lineWidth=1.0
  • lineCap='butt'
  • lineJoin='miter'
  • miterLimit=10
  • strokeStyle='black'
  • fillStyle='black'
  • shadowOffsetX=0.0
  • shadowOffsetY=0.0
  • shadowBlur=0.0
  • shadowColor='transparent black'
  • g=createLinearGradient(x0,y0,x1,y1)
  • g=createRadialGradient(x0,y0,r0,x1,y1,r1)
  • p=createPattern(image,repetition)
  • addColorStop(offset, color)
  • beginPath()
  • closePath()
  • fill()
  • stroke()
  • clip()
  • moveTo(x, y)
  • lineTo(x, y)
  • quadraticCurveTo(cpx, cpy, x, y)
  • bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
  • arcTo(x1, y1, x2, y2, radius)
  • arc(x, y, radius, startAngle, endAngle, anticlockwise)
  • rect(x, y, w, h)
  • b = isPointInPath(x, y)
  • clearRect(x, y, w, h)
  • fillRect(x, y, w, h)
  • strokeRect(x, y, w, h)
  • font='10px sans-serif'
  • textAlign='start'
  • textBaseline='alphabetic'
  • fillText(text, x, y, [maxWidth])
  • strokeText(text, x, y, [maxWidth])
  • m = measureText(text)
Frames
Delay
Width
Height