Watch a demo of different values of the createLinearGradient() method.
Or click a specific value to see the result:
const c = document.getElementById('myCanvas'); const ctx = c.getContext('2d'); const x = ctx.createLinearGradient(0, 0, 0, 170); x.addColorStop(0, "black"); x.addColorStop(1, "white"); ctx.fillStyle = x; ctx.fillRect(20, 20, 150, 100);