addOverlayRect = (gradientName, x, y, width, height) => {
  if (svg.select('.intermediate-layer-overlay').empty()) {
    svg.append('g').attr('class', 'intermediate-layer-overlay');
  }

  let intermediateLayerOverlay = svg.select('.intermediate-layer-overlay');

  let overlayRect = intermediateLayerOverlay.append('rect')
    .attr('class', 'overlay')
    .style('fill', `url(#${gradientName})`)
    .style('stroke', 'none')
    .attr('width', width)
    .attr('height', height)
    .attr('x', x)
    .attr('y', y)
    .style('opacity', 0);
  
  overlayRect.transition('move')
    .duration(800)
    .ease(d3.easeCubicInOut)
    .style('opacity', 1);
}
Add an overlaying rect
@param {string} gradientName Gradient name of overlay rect
@param {number} x X value of the overlaying rect
@param {number} y Y value of the overlaying rect
@param {number} width Rect width
@param {number} height Rect height