Skip to main content
qndo1999
Participant
June 16, 2026
Question

"expression result must be of dimension 2, not 1" when adding clamp expression

  • June 16, 2026
  • 0 replies
  • 0 views

Hi,

I’m trying to build a shape layer that adapts to the longest length between two text layers, but is limited to 850 pixels in size. Everything functions as it should until I add the clamp expression. The error “expression result must be of dimension 2, not 1” pops up on the first line. How can I fix it, or is there a better way to approach adding a limit to the size of the shape?

 

const line1 = thisComp.layer("First & Last Name, PhD"); // reference top line text layer 
const line2 = thisComp.layer("Title or Position"); // reference bottom line text layer
const boxWidth = Math.max(line1.sourceRectAtTime().width, line2.sourceRectAtTime().width) + 220; // compares the length of both text layers and returns the larger of the two including padding and leading
const boxHeight = line1.sourceRectAtTime().height + line2.sourceRectAtTime().height + 120; // height of box including padding

[boxWidth, boxHeight];

clamp(boxWidth, 0, 850);

Thanks in advance!