function explode([x, y]) {
  // Shift the coordinates by this value to avoid dealing with zeros.
  const shift = 4096;
  const x0 = x + shift, y0 = y + shift;
  const rx = x0 % 1, ry = y0 % 1;
  const bx = Math.floor(x0) - shift, by = Math.floor(y0) - shift;
  let p = [bx, by];
  p.alpha = (1-rx) * (1-ry);
  const out = [p];
  if (rx > 0) {
    p = [bx + 1, by];
    p.alpha = rx * (1 - ry);
    out.push(p);
  }

  if (ry > 0) {
    p = [bx, by + 1];
    p.alpha = (1 - rx) * ry;
    out.push(p);
  }

  if (rx > 0 && ry > 0) {
    p = [bx + 1, by + 1];
    p.alpha = rx * ry;
    out.push(p);
  }

  return out;
}
// return an array of points with opacities for a given point
return an array of points with opacities for a given point
return an array of points with opacities for a given point
function explode([x, y]) {
  const shift = 4096;
  const x0 = x + shift, y0 = y + shift;
  const rx = x0 % 1, ry = y0 % 1;
  const bx = Math.floor(x0) - shift, by = Math.floor(y0) - shift;
  let p = [bx, by];
  p.alpha = (1-rx) * (1-ry);
  const out = [p];
  if (rx > 0) {
    p = [bx + 1, by];
    p.alpha = rx * (1 - ry);
    out.push(p);
  }
  if (ry > 0) {
    p = [bx, by + 1];
    p.alpha = (1 - rx) * ry;
    out.push(p);
  }
  if (rx > 0 && ry > 0) {
    p = [bx + 1, by + 1];
    p.alpha = rx * ry;
    out.push(p);
  }
  return out;
}
function explode ( [ x , y ] ) { const shift = 4096 ; const x0 = x + shift , y0 = y + shift ; const rx = x0 % 1 , ry = y0 % 1 ; const bx = Math . floor ( x0 ) - shift , by = Math . floor ( y0 ) - shift ; let p = [ bx , by ] ; p . alpha = ( 1 - rx ) * ( 1 - ry ) ; const out = [ p ] ; if ( rx > 0 ) { p = [ bx + 1 , by ] ; p . alpha = rx * ( 1 - ry ) ; out . push ( p ) ; } if ( ry > 0 ) { p = [ bx , by + 1 ] ; p . alpha = ( 1 - rx ) * ry ; out . push ( p ) ; } if ( rx > 0 && ry > 0 ) { p = [ bx + 1 , by + 1 ] ; p . alpha = rx * ry ; out . push ( p ) ; } return out ; }
return an array of points with opacities for a given point
return an array of points with opacities for a given point
// Shift the coordinates by this value to avoid dealing with zeros.