src/tools/SpotlightEffect.js
// firstElement is an optional argument; it specifies the first

firstElement is an optional argument; it specifies the first
firstElement is an optional argument ; it specifies the first
function createSpotlightEffect(firstElement) {
  canvas = document.createElement("CANVAS");
  canvas.addEventListener("mousemove", (e) => {
    draw(e);
  });
  canvas.addEventListener("mouseleave", (e) => {
    draw(null);
  });
  window.addEventListener("resize", onWindowResize);
  canvas.style.position = "absolute";
  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;
  context = canvas.getContext("2d");
  console.log(
    "dflkjdf: " +
      document.getElementById("app").isSameNode(document.body.firstChild)
  );
  console.log("firstchild: " + JSON.stringify(document.body.firstChild));
  document.body.insertBefore(canvas, document.body.childNodes[0] || null);
  draw(null);
}
function createSpotlightEffect ( firstElement ) { canvas = document . createElement ( "CANVAS" ) ; canvas . addEventListener ( "mousemove" , ( e ) => { draw ( e ) ; } ) ; canvas . addEventListener ( "mouseleave" , ( e ) => { draw ( null ) ; } ) ; window . addEventListener ( "resize" , onWindowResize ) ; canvas . style . position = "absolute" ; canvas . width = window . innerWidth ; canvas . height = window . innerHeight ; context = canvas . getContext ( "2d" ) ; console . log ( "dflkjdf: " + document . getElementById ( "app" ) . isSameNode ( document . body . firstChild ) ) ; console . log ( "firstchild: " + JSON . stringify ( document . body . firstChild ) ) ; document . body . insertBefore ( canvas , document . body . childNodes [ 0 ] || null ) ; draw ( null ) ; }
firstElement is an optional argument; it specifies the first
firstElement is an optional argument ; it specifies the first
/*
   * If the mouse leaves the window, the spotlight will remain in the last position
   * at which the mous was still in the window - unless we remove it!
   */