さて、周りを見回して、キャンバスに円を描き、その円を画像のマスクとして使用できるコードを見つけました。
コードは次のようになります: (私が知らない本当の作成者へのコード)
var ctx = document.getElementById('your_canvas').getContext("2d");
ctx.arc(100,100, 50, 0, Math.PI*2,true); // you can use any shape
ctx.clip();
var img = new Image();
img.addEventListener('load', function(e) {
ctx.drawImage(this, 0, 0, 200, 300);
}, true);
img.src="/path/to/image.jpg";
5 つの異なる円をすべて異なる画像で配置し、それぞれを異なる位置に配置したいとします。
誰かがそれについてどのように行くかについて考えを持っていますか?