obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian

View on GitHub

◀ Excalidraw Automate How To

Connect Objects

This Templater template demonstrates how to connect two objects using ExcalidrawAutomate.

Use CTRL+Shift+V to paste code into Obsidian!

<%*
  const ea = ExcalidrawAutomate;
  ea.reset();
  ea.addText(-130,-100,"Connecting two objects");
  const a = ea.addRect(-100,-100,100,100);
  const b = ea.addEllipse(200,200,100,100);
  ea.connectObjects(a,"bottom",b,"left",{numberOfPoints: 2}); //see how the line breaks differently when moving objects around
  ea.style.strokeColor = "red";
  ea.connectObjects(a,"right",b,"top",1);
  await ea.create();
%>