diff options
Diffstat (limited to 'examples/script/context2d/scripts/alpha.js')
-rw-r--r-- | examples/script/context2d/scripts/alpha.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/script/context2d/scripts/alpha.js b/examples/script/context2d/scripts/alpha.js new file mode 100644 index 0000000..23fa5d4 --- /dev/null +++ b/examples/script/context2d/scripts/alpha.js @@ -0,0 +1,21 @@ +var ctx = document.getElementById('tutorial').getContext('2d'); + // draw background + ctx.fillStyle = '#FD0'; + ctx.fillRect(0,0,75,75); + ctx.fillStyle = '#6C0'; + ctx.fillRect(75,0,75,75); + ctx.fillStyle = '#09F'; + ctx.fillRect(0,75,75,75); + ctx.fillStyle = '#F30'; + ctx.fillRect(75,75,75,75); + ctx.fillStyle = '#FFF'; + + // set transparency value + ctx.globalAlpha = 0.2; + + // Draw semi transparent circles + for (i=0;i<7;i++){ + ctx.beginPath(); + ctx.arc(75,75,10+10*i,0,Math.PI*2,true); + ctx.fill(); + } |