Copy link to clipboard
Copied
Hi everyone.
Trying to figure out the best way to create a function that uses a linear(input, min, max, outmin, outmax) setup but, here's the trick: only does that for a specified amount and at the end goes back to the starting value.
I'm planning on using it to control the scale of a layer when a null layer is just above it, when the null layer is past the layer it goes back to the starting state.
As I understand the linear() function it doesn't have a way to define a specific range that the calculation is based on?
Any help is greatly appreciated!
You didn't provide much detail, so this is pretty general, but probably something like this:
minDist = 100;
maxDist = 400;
d = length(thisComp.layer("Null 1").position,position);
linear(d,minDist,maxDist,[150,150],value)
Dan
Copy link to clipboard
Copied
You didn't provide much detail, so this is pretty general, but probably something like this:
minDist = 100;
maxDist = 400;
d = length(thisComp.layer("Null 1").position,position);
linear(d,minDist,maxDist,[150,150],value)
Dan
Copy link to clipboard
Copied
Hi Dan!
Yeah, this is exactly what I was trying to achieve!
But I don't really understand why and how it works: do you mind explaining the length function and the setup in general?
Copy link to clipboard
Copied
You can use length() to measure the distance between two layers. Then I just used linear() to scale the layer up as the null approaches. You might want to adjust maxDist (the distance where the null has no effect) and minDist (where the null has the maximum effect).
Dan