Skip to content

Commit

Permalink
fix: reveal-the-cat black bg
Browse files Browse the repository at this point in the history
  • Loading branch information
ff6347 committed Nov 18, 2024
1 parent 3b5c767 commit 7071d10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions p5js/reveal-the-cat/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
display: flex;
justify-content: center;
align-items: center;
background-color: black;
}
</style>

<script src="/public/js/p5.min.js"></script>
<script src="index.js"></script>

Expand Down
9 changes: 5 additions & 4 deletions p5js/reveal-the-cat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ function preload() {
function setup() {
createCanvas(300, 200);
rectMode(CENTER);
// imageMode(CENTER)
stroke('white');
fill('black');
}

function draw() {
image(img, 0, 0);
// Get a region of the image.
let c = get(mouseX - 15, mouseY - 15, 15, 15);
noStroke;
fill('black');

// mask the image
rect(width / 2, height / 2, width, height);
// Display the region.
// Display only the region.
image(c, mouseX - 15, mouseY - 15);
}

0 comments on commit 7071d10

Please sign in to comment.