xxxxxxxxxx
34
let face; // Variable to store the face image
let matte; // Variable to store the matte image
function preload() {
// Load the face image
face = loadImage("153423.jpg");
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(0, 0, 70); // Set background color
// Create a graphics object for the matte
matte = createGraphics(face.width, face.height);
// matte.background(0); // Background color for the matte
matte.fill(25); // Fill color for the matte
matte.noStroke();
matte.ellipse(matte.width / 2, matte.height / 2 -15, matte.width); // Draw an ellipse as the matte
}
function draw() {
background(0, 0, 70); // Set background color
// Draw the face image
face.mask(matte);
image(face, 100, 100);
fill(170,160,60);
ellipse(200, 200, matte.width+10)
// Draw the matte image uncomment to see
// image(matte, 100, 100);
}