Slider Control expression position
Hello everybody,
Hopefully somebody can help me out with this:
There are two text layers in my composition and I have a rectangle that is linked to the size of the text of these layers. This worked quite wel so far, but
if my first text layer has more than one line of text, I need to reposition my second text layer. Therefore I made a slider which controls the vertical position of my second text layer. Now I would like to link the size of the rectangle to the y-position of the second text layer. So that if I lower the second text layer, the rectangle grows with a certain amount. Hopefully I could explain the problem clear enough.
This is my code. Please tell me what I am doing wrong. Thank you so much in advance.
heightTextLayer1 = thisComp.layer("Text Layer 1").sourceRectAtTime().height+300;
positionTextLayer2 = thisComp.layer("SLIDER CONTROL Positie").effect("Slider Position Text Layer 2")("Slider").value;
if (positionTextLayer2 >= 0) {
heightTextLayer2 = thisComp.layer("Text Layer 2").sourceRectAtTime().height+300;}
else if (positionTextLayer2 >= 800) {
heightTextLayer2 = thisComp.layer("Text Layer 2").sourceRectAtTime().height+700;}
else if (positionTextLayer2 >= 900) {
heightTextLayer2 = thisComp.layer("Text Layer 2").sourceRectAtTime().height+800;}
else {positionTextLayer2 = thisComp.layer("Text Layer 2").sourceRectAtTime().height+1000;}
x = 1920
if (heightTextLayer1 > heightTextLayer2) {y = heightTextLayer1} else {y = heightTextLayer2}
[x, y]
