| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Gradient Test</title> |
| 5 |
<style> |
| 6 |
|
| 7 |
body { |
| 8 |
text-align: center; |
| 9 |
background: pink |
| 10 |
} |
| 11 |
|
| 12 |
</style> |
| 13 |
|
| 14 |
<script> |
| 15 |
|
| 16 |
window.onload = function() { |
| 17 |
var ctx = document.getElementById('c').getContext('2d'); |
| 18 |
|
| 19 |
var g1 = ctx.createLinearGradient(0, 0, 300, 200); |
| 20 |
g1.addColorStop(0.0, 'rgba(0, 255, 0, 0.0)'); |
| 21 |
g1.addColorStop(1.0, 'rgba(0, 255, 0, 1.0)'); |
| 22 |
|
| 23 |
var g2 = ctx.createLinearGradient(0, 0, 300, 200); |
| 24 |
g2.addColorStop(0.0, 'rgba(0, 255, 0, 1.0)'); |
| 25 |
// VML Bug |
| 26 |
g2.addColorStop(1.0, 'rgba(0, 0, 0, 0.0)'); |
| 27 |
ctx.fillStyle = g1; |
| 28 |
ctx.fillRect(0, 0, 300, 100); |
| 29 |
ctx.fillStyle = g2; |
| 30 |
ctx.fillRect(0, 100, 300, 100); |
| 31 |
}; |
| 32 |
|
| 33 |
</script> |
| 34 |
</head> |
| 35 |
<body> |
| 36 |
|
| 37 |
<canvas id=c width=300 height=200></canvas> |
| 38 |
|
| 39 |
<p>This tests gradients</p> |
| 40 |
|
| 41 |
</body> |
| 42 |
</html> |