I've been experimenting with masking using an SVG shape that I created in the HTML content. I've tried various options:
- mask, -webkit-mask
- mask-image, -webkit-mask-image
- different MaskUnits and MaskContentUnits
- mask-type: luminance or not
Despite my efforts, I can't seem to get it to work properly. I must be missing something obvious.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><
<title>Mask with SVG</title><
<link rel="stylesheet" href="/style.css" /><
<style>
.testMask {
-webkit-mask-image: url(#torch);
mask-image:url(#torch);
}
</style><
</head><
<body><
<svg width="0" height="0"><
<defs><
<mask id="torch"><
<circle cx="0.5" cy="0.5" r="0.1" fill="white" /><
</mask><
</defs><
</svg><
<div id="mainPage"><
<img src="/img/Japan.jpg" class="testMask"><
</div><
</body><
Do you see any issues in this code snippet? Additionally, is there a way to dynamically change the mask coordinates with JavaScript? I'm looking to have it follow the mouse pointer.
Thank you!