connect = (sender, receiver) => {
      // Get the (x, y) coordinates of sender and receiver node
      const x1 = sender.cx;
      const y1 = sender.cy;
      const x2 = receiver.cx;
      const y2 = receiver.cy;

      // Calculate the total distance between the node
      const dis = Math.sqrt(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2)) - sender.radius;
      // Calculate the angle of line between the nodes along x axis.
      // Slope is calculated first
      const angle = Math.atan2(y2-y1, x2-x1);
      
      if (this.state.start > dis) {
        this.state.start = 0;
      }

      new CanvasElements.Line({
        x: x1 + this.state.start * Math.cos(angle),
        y: y1 + this.state.start * Math.sin(angle),
        r: 0.2 * dis,
        angle,
        borderWidth: 2,
        borderColor: '#3BE8B0',
        ctx: this.ctx,
      });      
    }
Empty the canvas, and add the updated nodes, connections and labels