xxxxxxxxxx
34
// https://www.artic.edu/collection?is_public_domain=1
// https://www.artic.edu/artworks/43714/e-10-english-dining-room-of-the-georgian-period-1770-90
// https://github.com/processing/p5.js/wiki/Positioning-your-canvas
function preload() {
room = loadImage("uu.png");
}
function setup() {
cnv = createCanvas(400, 500);
centerCanvas();
mask_layer = createGraphics(width, height);
img = createImage(width, height);
}
function draw() {
if (frameCount % 300 == 0) {
mask_layer.clear();
}
mask_layer.circle(random(width), random(height), 30);
img.copy(room, 0, 0, room.width, room.height, 0, 0, width, height);
img.mask(mask_layer);
image(img, 0, 0, width, height);
}
function centerCanvas() {
var x = (windowWidth - width) / 2;
var y = (windowHeight - height) / 2;
cnv.position(x, y);
}
function keyPressed() {
if (key == "s") {
saveGif("mask.gif", 5);
}
}