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
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]
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.
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.