-
linear() but with more than two sets of variables?
I’m creating a PremierePro Mogrt in AE’s Essential graphics, so most things in my project need to be dynamic and controllable with sliders. I’m animating an object from point A to point B using linear() tied to a slider to animate it, rather than using keyframes. As the slider goes from 0 to 1, the object moves in a straight line between the two points.
s = effect("A to B")("Slider");
x=effect("Callout Start")("Point");
y=effect("Callout End")("Point");
n1=x[0];
n2=x[1];
n3=y[0];
n4=y[1];
s1=linear(s, 0,1, n1, n3);
s2=linear(s, 0,1, n2, n4);
[s1,s2];So far so good. Now I’d like to dynamically adjust the midpoint of that line, so the object goes from A to C to B.
My thought process is that I would calculate the midpoint of the imaginary line from A to B on a point controller, then use another point controller to add an offset value to the first point controller (the offset controller is what would be added to the mogrt essential graphics, fyi).
Where I’m getting stuck is making the position of that midpoint have any affect on the location of the object as it travels from A to B. I’d like to be able to add “.5” as an input variable in the linear() expression, with a link to the first point controller as the output variable, but alas, linear() can only have 3 or 5 arguments. What I’m looking for would be 7.
Any ideas for how to accomplish this?