summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/gradient-add-second-start-end-stop.html
blob: 76b239bf432cc3a1078d9687d1bdcd9ceb93985a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<body>
<canvas id="c" width="600" height="100"></canvas>
<script>
if (window.testRunner)
  testRunner.dumpAsTextWithPixelResults();

var canvas = document.getElementById("c");
var ctx = canvas.getContext("2d");

var gradient = ctx.createLinearGradient(0, 0, 0, 100);
gradient.addColorStop(0.4, "#f00");
gradient.addColorStop(0.6, "#00f");

ctx.fillStyle = gradient;
ctx.fillRect(0, 0, 100, 100);

gradient.addColorStop(0, "#fff");
gradient.addColorStop(1, "#fff");
ctx.fillStyle = gradient;
ctx.fillRect(150, 0, 100, 100);
</script>
</body>