Hi, I’m new and I don’t know how to fill in a circle with an image …
I know how to do it with pure javascript, but with Phaser I couldn’t do it.
I am very grateful for the help!
code with pure javascript:
var canvas = document.getElementById(‘canvas’);
var ctx = canvas.getContext(‘2d’);
var img = new Image();
img.src = ‘https://phaser.io/images/logo/logo-download-vector.png’;
img.onload = function() {
var pattern = ctx.createPattern(img, ‘repeat’);
ctx.fillStyle = pattern;
ctx.beginPath();
ctx.arc(300, 175, 150, 0, 2 * Math.PI);
ctx.fill();
};
Outcome: