2021-06-10 20:39:09 +08:00
|
|
|
export default function globalAlpha(ctx) {
|
2015-06-13 17:06:25 -07:00
|
|
|
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
|
2021-06-10 20:39:09 +08:00
|
|
|
for (let i=0;i<7;i++){
|
2015-06-13 17:06:25 -07:00
|
|
|
ctx.beginPath();
|
|
|
|
ctx.arc(75,75,10+10*i,0,Math.PI*2,true);
|
|
|
|
ctx.fill();
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.globalAlpha = 1.0;
|
|
|
|
};
|