Diagonal corner to corner gradient in canvas
<p>I need to have a diagonal gradient from corner to corner in a canvas, not css.</p>

<pre><code>Check example : http://jsfiddle.net/58y8b/77/
</code></pre>

<p>The first box is fine, since it's a square the gradient coordinates are just top left and bottom right.
Is there a way to calculate those coordinates for the next 2 rectangles so they get the gradient from corner to corner like the first box?</p>