SHOW:
|
|
- or go back to the newest paste.
1 | window.onload = function () { | |
2 | var drawingSurface = document.getElementById("drawingSurface"); | |
3 | var ctxt = drawingSurface.getContext("2d"); | |
4 | ctxt.lineWidth = 3; | |
5 | - | ctxt.rect(150, 150, 200, 125); |
5 | + | ctxt.rect(150, 150, 250, 175); |
6 | - | var gradient = ctxt.createLinearGradient(150, 150, 200, 125); |
6 | + | var gradient = ctxt.createRadialGradient(200, 200,5, 250, 250,100); |
7 | - | gradient.addColorStop(0, "Black"); |
7 | + | gradient.addColorStop(0, "Red"); |
8 | - | gradient.addColorStop(0.5, "Gray"); |
8 | + | gradient.addColorStop(.5, "Orange"); |
9 | - | gradient.addColorStop(1,"White"); |
9 | + | gradient.addColorStop(1, "Blue"); |
10 | - | ctxt.fillStyle = gradient;ctxt.fill(); |
10 | + | ctxt.fillStyle = gradient; |
11 | - | ctxt.stroke(); |
11 | + | ctxt.fill();ctxt.stroke(); |
12 | } |