diff options
Diffstat (limited to 'examples/script/context2d/scripts/rgba.js')
-rw-r--r-- | examples/script/context2d/scripts/rgba.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/script/context2d/scripts/rgba.js b/examples/script/context2d/scripts/rgba.js new file mode 100644 index 0000000..a4e5e9a --- /dev/null +++ b/examples/script/context2d/scripts/rgba.js @@ -0,0 +1,19 @@ +var ctx = document.getElementById('tutorial').getContext('2d'); + + // Draw background + ctx.fillStyle = 'rgb(255,221,0)'; + ctx.fillRect(0,0,150,37.5); + ctx.fillStyle = 'rgb(102,204,0)'; + ctx.fillRect(0,37.5,150,37.5); + ctx.fillStyle = 'rgb(0,153,255)'; + ctx.fillRect(0,75,150,37.5); + ctx.fillStyle = 'rgb(255,51,0)'; + ctx.fillRect(0,112.5,150,37.5); + + // Draw semi transparent rectangles + for (i=0;i<10;i++){ + ctx.fillStyle = 'rgba(255,255,255,'+(i+1)/10+')'; + for (j=0;j<4;j++){ + ctx.fillRect(5+i*14,5+j*37.5,14,27.5) + } + } |