Copy link to clipboard
Copied
I'm curious if there's is a solution to the following:
var horizontal = comp("Render").layer("Controller").effect("B-films Credits Builder")("Horizontal Position");
var vertical = comp("Render").layer("Controller").effect("B-films Credits Builder")("Vertical Position");
var depth = comp("Render").layer("Controller").effect("B-films Credits Builder")("Depth Position");
[horizontal, 1920 - 420 - vertical, -depth];
The bold text has to be automatically calculated when the vertical slider is between 0 and 540.
If the vertical slider is at 540 it should be 420, when the vertical slider is at 0 it should be 0 and between those value it should calculate the value automatically.
Is there any way to do this?
You just need to declare some variables. Here's the code on a text layer and the resulting values:
vertical = effect("Slider 1")("Slider").value.toFixed(1);
vertical_Clamp = clamp(vertical, 0, 540).toFixed(1);
vertical_Ofst = linear(vertical_Clamp, 0, 540, 0, 420).toFixed(1);
// the following code displays the values for the variables
"Vertical Slider: " + vertical + "\r" +
"Vertical Clamp: " + vertical_Clamp + "\r" +
"Vertical Offset: " + vertical_Ofst
Plug those variables into your expre
...Copy link to clipboard
Copied
If you know the values it's as imple as using a linear() interpolator to derive the inbetween values:
linear(vertical, 540,0,420,0);
Mylenium
Copy link to clipboard
Copied
It sorta works, it sorta doesn't.
I need the slider to keep it's original values.
I only need the offset between 1920 and the slider to be recalculated.
Copy link to clipboard
Copied
You just need to declare some variables. Here's the code on a text layer and the resulting values:
vertical = effect("Slider 1")("Slider").value.toFixed(1);
vertical_Clamp = clamp(vertical, 0, 540).toFixed(1);
vertical_Ofst = linear(vertical_Clamp, 0, 540, 0, 420).toFixed(1);
// the following code displays the values for the variables
"Vertical Slider: " + vertical + "\r" +
"Vertical Clamp: " + vertical_Clamp + "\r" +
"Vertical Offset: " + vertical_Ofst
Plug those variables into your expression and it should work. I added clamp(1) to the end of each variable to clean up the text display. You can delete it unless you want pixel-level rounding.
Copy link to clipboard
Copied
Thank you very much!
This is exactly what I meant!