HTML5 Canvas Slope Field