<canvas id="canvas"></canvas>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

canvas.width = window.innerWidth * 2;
canvas.height = window.innerHeight * 3;

canvasW = canvas.width;
canvasH = canvas.height;


let img = new Image();
img.src = 'https://dl.dropbox.com/s/l4gbjtkduy9wzj5/pig.png?dl=0';

window.addEventListener('load', function () {
  ctx.beginPath();
  let imagePattern = ctx.createPattern(img, 'repeat');
  ctx.fillStyle = imagePattern;
  ctx.rect(0, 0, canvasW, canvasH);
  ctx.fill();
  ctx.closePath();
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.