Skip to content

Instantly share code, notes, and snippets.

@yoannmoinet
Last active November 13, 2017 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoannmoinet/1d1090ebb51136e6168eaa05dbe85e87 to your computer and use it in GitHub Desktop.
Save yoannmoinet/1d1090ebb51136e6168eaa05dbe85e87 to your computer and use it in GitHub Desktop.
Apply a masked circle on element.
// Main process
export const createSeeThroughWindow = () => {
const w = new BrowserWindow({ transparent: true });
w.setIgnoreMouseEvents(true);
};
// Renderer process
const mask_radius = 200;
export const moveSeeThrough = ({x, y}) => {
const $body = document.body;
const newX = $body.scrollLeft + x;
const newY = $body.scrollTop + y;
$body.setAttribute('style', `-webkit-mask-image: radial-gradient(
${mask_radius}px at ${newX}px ${newY}px ,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0) 99%,
rgba(0, 0, 0, 1) 100%
);`);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment