Complete the code to measure the distance between two objects in Figma.
distance = frame1.[1](frame2)In Figma, distanceTo is used to measure the distance between two objects.
Complete the code to show the spacing between selected layers in Figma.
figma.showSpacingBetween([1])The selection object in Figma represents the currently selected layers, which is used to show spacing.
Fix the error in the code to correctly get horizontal spacing between two nodes.
horizontalSpacing = node1.[1](node2, 'horizontal')
The distanceTo method correctly calculates the distance between two nodes, and can take an optional direction parameter.
Fill both blanks to create a function that returns vertical spacing between two frames.
function getVerticalSpacing(frameA, frameB) {
return frameA.[1](frameB, [2])
}The distanceTo method with the 'vertical' parameter returns vertical spacing between frames.
Fill all three blanks to create a function that calculates spacing and logs it with a label.
function logSpacing(obj1, obj2) {
const spacing = obj1.[1](obj2, [2])
console.[3](`Spacing is: ${spacing}px`)
}The distanceTo method calculates spacing, and console.log outputs the message.