gradient = {
const ctx = DOM.context2d(width, height);
const grad = ctx.createLinearGradient(0, 0, 200, 0);
grad.addColorStop(0, "skyblue");
grad.addColorStop(0.5, "lightgreen");
grad.addColorStop(1, "orange");
ctx.fillStyle = grad;
ctx.font = "40px serif";
ctx.beginPath();
ctx.fillRect(0,0,500,400);
ctx.fillText("Rect1", 10, 40);
ctx.strokeText("Rect1", 10, 40);
ctx.fillRect(100,100,300,200);
ctx.strokeRect(100,100,300,200);
ctx.fillText("Rect2", 110, 140);
ctx.strokeText("Rect2", 110, 140);
ctx.save();
ctx.translate(600, 0);
ctx.beginPath();
ctx.fillStyle = "#eee";
ctx.fillRect(0, 0, width-600, height);
let x1 = 100,
y1 = 200,
r1 = 40,
x2 = 240,
y2 = 200,
r2 = 80;
const radialGrad = ctx.createRadialGradient(x1, y1, r1, x2, y2, r2);
radialGrad.addColorStop(0, "skyblue");
radialGrad.addColorStop(0.5, "lightgreen");
radialGrad.addColorStop(1, "orange");
ctx.fillStyle = radialGrad;
ctx.arc(200, 200, 200, 0, Math.PI*2, 0);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(x2, y2, r2, 0, Math.PI*2, 0);
ctx.stroke();
ctx.beginPath();
ctx.arc(x1, y1, r1, 0, Math.PI*2, 0);
ctx.stroke();
ctx.restore();
return ctx.canvas;
}