Skip to content

Instantly share code, notes, and snippets.

@mashaal
Created August 22, 2016 02:28
Show Gist options
  • Select an option

  • Save mashaal/ff5e24f8c6decafb952516ba56c3a57d to your computer and use it in GitHub Desktop.

Select an option

Save mashaal/ff5e24f8c6decafb952516ba56c3a57d to your computer and use it in GitHub Desktop.

Revisions

  1. mashaal created this gist Aug 22, 2016.
    6 changes: 6 additions & 0 deletions retina-canvas.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    // example for retina canvas

    this.canvas.width = this.width * window.devicePixelRatio
    this.canvas.height = this.height * window.devicePixelRatio
    this.canvas.style.width = `${this.width}px`
    this.canvas.style.height = `${this.height}px`