Overlay on a div with a certain cutout in the middle.

Actually this is on top of a video stream but for simplicity sake lets just say its over a div. I am trying to create a verification system where the user can verify themselves using facial verification. For the design part I need to display a face cutout overlay on my video stream essentially telling the user to place their face in the cutout to verify themselves. What is the best possible approach to this? I have provided an image of what I am trying to achieve but for web. Any help will be greatly appreciated.
No description
6 Replies
MarkBoots
MarkBoots5mo ago
or instead of the mask just a bg-gradient for the overlay
background-image: radial-gradient(transparent 50%, rgb(0 0 0 /.5) 50%)
background-image: radial-gradient(transparent 50%, rgb(0 0 0 /.5) 50%)
Kevin Powell
Kevin Powell5mo ago
no idea why I did a mask using the same gradient I could have just used a gradient for, lol.
MarkBoots
MarkBoots5mo ago
i was thinking of it too, until i saw your pen and thought, wait a minute
clevermissfox
clevermissfox5mo ago
As Mark has taught me, with both the mask of the bg-img you may want to use a calc to account for the fuzzy edges
background: radial-gradient(transparent 50%, hsl(0 0% 0% / 0.5) calc(1px + 50%));
background: radial-gradient(transparent 50%, hsl(0 0% 0% / 0.5) calc(1px + 50%));
capt_uhu
capt_uhu5mo ago
it's a bit fiddly but you should also be able to do the thin white oval line as part of the gradient:
background-image:
radial-gradient(
#0000 calc(50% - 1px),
#fff calc(50% + 1px),
rgb(0 0 0 / .5) calc(50% + 2px));
background-image:
radial-gradient(
#0000 calc(50% - 1px),
#fff calc(50% + 1px),
rgb(0 0 0 / .5) calc(50% + 2px));
Want results from more Discord servers?
Add your server