ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using A Layer Position to Control a specific range value?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Robert Merritt
Using A Layer Position to Control a specific range value?
on Oct 26, 2018 at 3:41:49 am

Ive been trying to see if I can figure this out for a couple days, so I wanted to see if anyone can help me here...

This is what im trying to achieve. I have a source text (with a slider in its effects that controls its value) and a layer/graphic that needs to move up and down. I need the slider value to be parented to the y axis of the layer's position. However, when I do that im obviously getting numbers in the hundreds to thousands when I slide the layer up and down.

My goal is to still have the value parent to the y axis, but instead of giving me the same value as that axis, I need it to be a specific range instead of following the positions value. By default when the layer is at the bottom of the comp, I need the value at zero, but when you slide the layer to the top, it goes all the way up to 25 but stops there.

Obviously if I take the "current" number in the position value and subtract that in the value of the slider, it will get me at zero. But because the position value is sensitive to large numbers, im not sure how to tell the slider to be more relative to that number so I can slide the position all the way up, and have the value make its way to 25 instead of 2000?

Hopefully that made sense... Any help would be awesome!


Return to posts index

Scott McGee
Re: Using A Layer Position to Control a specific range value?
on Oct 26, 2018 at 7:55:55 am

This will work if you want it to go from 0-25 based on the Comps height.

x = value[0];
y = effect("Slider Control")("Slider") * thisComp.height/25;
[x,y]

If you have a fiddle, you can update it so it doesn't go below or above a certain height.

If (effect("Slider Control")("Slider") > 5 && effect("Slider Control")("Slider") < 20){
Above expression
} else {
Where you want it to go otherwise
}


Return to posts index

Robert Merritt
Re: Using A Layer Position to Control a specific range value?
on Oct 26, 2018 at 3:45:56 pm

Thanks for your help Scott I appreciate it! I really gotta learn expressions more... So im not able to get this to work. Once I replace the slider with the one in my comp it seems to be throwing back an odd number. And when I move it up or down it doesnt seem to change the value. What could I be doing wrong?



This is a image of my graphic and my text layer. The code you gave me is throwing that number on-screen back at me. I also have it set to give me one decimal point.

I have the text layer parented to the graphic slider. When I move this slider up im trying to see if I can find a way to have it get to 24 from 0. Any thoughts? Im open to following any workflow to make this work.


Return to posts index


Dan Ebberts
Re: Using A Layer Position to Control a specific range value?
on Oct 26, 2018 at 4:05:58 pm

It sounds like you just need to use linear() to remap your range, something like this:

linear(position[1],0,thisComp.height,25,0)



Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]