Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created July 14, 2015 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/f57ffc2b57e08265610a to your computer and use it in GitHub Desktop.
Save tmcw/f57ffc2b57e08265610a to your computer and use it in GitHub Desktop.

canvas speed tricks

  • changing fill properties is expensive. change fill color, opacity, line color, line width as infrequently as possible
  • it's faster to do a lot of ctx.rect and then one ctx.fill than to ctx.fillRect
  • always draw to even pixels, for widths and locations. use ~~ to do this.
  • use a module like leftpad to write out the files in a way that ffmpeg can understand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment