-
Dynamic Text Positioning/Scaling
Hello all,
this is my first question for this fine community. I consider myself a beginner with expressions. I know some of the basics and already managed to solve some problems on my own by finding workarounds, etc. Now here is the problem that i can’t find a sufficient workaround for: I am producing templates for onair graphics that editors use to put text on their inhouse-edited films. We have a certain CI for end credits, which is divided as follows:
main credit line 1
main credit line 2
main credit line 3single credit block 1 line 1 single credit block 2 line 1 single credit block 3 line 1
single credit block 1 line 2 single credit block 2 line 2 single credit block 3 line 2
single credit block 1 line 3 single credit block 2 line 3 single credit block 3 line 3
single credit block 1 line 4 single credit block 2 line 4 single credit block 3 line 4
single credit block 1 line 5 single credit block 2 line 5 single credit block 3 line 5edit: there is some free space between the blocks. The forum erases that, so just think of it as three blocks of text. I will add a picture soon for better understanding.
Main credit line 1-3 is an individual text layer, just as every block is an individual text layer.
There is nine blocks in total, which fade from one another, so block 1, 2 ,3 are fading to block 4,5,6 etc (but thats not important as i managed to automatize the fading based on amount of credits already).
The lowest line 5 of these blocks is about aligned to the inner title safe line.Maybe the problem(s) with this layout are already clear just by looking at this. Imagine your text for one of these blocks or even lines is very long. It will overlap with the line of the block to the right side or go out of frame entirely. Adding more lines (say 5-6) will lead to the text going out of the frame eventually.
I developed a template to scale and move the text according to controllers. You would have a slider control that says “scale of font” that scales all of these blocks equally or a “number of lines” slider that would hide lines automatically with subtract masks or move the text up when lines are added. All this made things easier already. But the editors want it even more simpler and just copy paste infos. I would have to automatize the scaling and positioning based on the amount of characters, or better saying on the size of the text’s bounding box.
Here is what should happen: at the point that one of the block’s lines would intersect with its neighbor to the right, it would start scaling the font for all blocks down, while also moving all blocks as well as the main credit lines up and down, depending on the amount of lines and size of text for the largest block. I hope its clear enough what i am aiming for. After you copy paste the infos, the blocks would be aligned perfectly without crossing over, going out of frame or loosing their relative spacing to the main credit line (so this one must move up and down with them).
I have spent hours trying to understand the sampleImage methods provided by Dan Ebberts and others in here: https://aenhancers.com/viewtopic.php?f=6&t=939&view=previous. I know the key is in there somewhere. Problem is, all of these are very slow to compute for each credit block or they are not compatible for some reason with a resolution larger than 1024×576… plus they are hard to modify for a expressions beginner like myself. I was only able to adjust the second version on that link, so that it moves a single credit and scales it based on width and height information, but this expression is too slow to use for all blocks plus main credit line. I already found a way to narrow all values of all blocks to the largest one but its worthless without determining the length and height information from the text itself in an efficient way. Is sampleImage the best way? I would imagine maybe not sampleImage-ing every block but all at once somehow (all expressions i found only sample one text layer)? Or is there an alternative? Is it even possible at all?
I have reached a point where i am pretty lost and hope you guys can help me out.
regards,
Andy