Skip to main content
Participant
July 28, 2022
Answered

random size shapes and follow text width

  • July 28, 2022
  • 2 replies
  • 581 views

 

 

 

I want an expression where each shape has a random height and automatically adds a shape according to the text length.

 

please let me know if there's a good way

This topic has been closed for replies.
Correct answer Dan Ebberts

Maybe something like this:

minHeight = 25;
maxHeight = 50;
seedRandom(index,true);
h = random(minHeight,maxHeight);
r = thisComp.layer("text").sourceRectAtTime(time,false);
w = r.width;
[w,h]

2 replies

Mylenium
Legend
July 28, 2022

Expressions cannot duplicate items nor can a Repeater have random sizes and that's pretty much all there is to say. You can randomize the size using the expression Dan provided just liek you can have their spacing calculated automatically, but you have to manually duplicate the rectangles. That said, it might be easier to just find a suitable dingbat font with a rounded square and type out the lines, then apply text animators for size with a wiggly/ random selector.

 

Mylenium

Participant
July 28, 2022

thx!

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
July 28, 2022

Maybe something like this:

minHeight = 25;
maxHeight = 50;
seedRandom(index,true);
h = random(minHeight,maxHeight);
r = thisComp.layer("text").sourceRectAtTime(time,false);
w = r.width;
[w,h]
Participant
July 28, 2022
thank you for answer.

however, I mean that the width of the shape is not adjusted according to the text,
but a shape of random height is added like a repeater effect.