• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit

Explorer ,
Oct 27, 2023 Oct 27, 2023

Copied

I have a gradient ramp, and I want to link only the vertical axes of the Start and End to a single Slider control. And I want them to stay 100 pixels apart. How do I do this?

Thank you.

TOPICS
Expressions , Scripting

Views

376

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
4 Replies 4
Community Expert ,
Oct 27, 2023 Oct 27, 2023

Copied

You would add an expression control slider to the layer, tie the y position of the Start Value for the gradient to the slider, and

then add 100 to the y value of the End Value for the gradient. If the gradient is on a shape layer, the expressions would look like this:

``````// Start property
t = - thisComp.height/2;
y = t + effect("Slider Control")("Slider") * 20;
[value[0], y]

// End property
x = content("Rectangle 1").content("Gradient Fill 1").startPoint[0];
y = content("Rectangle 1").content("Gradient Fill 1").startPoint[1] + 100;
[x, y]
``````

Because the gradient position is centered on the layer, you would define the top of the comp by subtracting half the comp height. To make the slider work on a percentage of the comp height, instead of having to scroll to numbers over 1000, multiply the slider value by 20, so zero to one hundred will give you a slider that moves the start point from the top to the bottom of the comp.

If you are using Gradient Fill, you don't have to subtract half the comp height.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Oct 27, 2023 Oct 27, 2023

Copied

Thank you. Sorry, I'm not quite understanding. Shouldn't I simply pick-whip the Start and End ramp positions to the slider, then modify the expressions that AE generates? If I was able to separate the x and y positions of those points, like you can with a lot of other things, I wouldn't be so confused.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Oct 27, 2023 Oct 27, 2023

Copied

... for example... when I pick-whip the ramp start to the slider, and type at the end of AE's expression "+100" it does what I think it should do, but only on the x-axis instead of the y. I don't know how to make it effect the y and not the x.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Expert ,
Oct 27, 2023 Oct 27, 2023

Copied

LATEST

The most efficient way to offset the End Point Y value only is to add 100 to the Y Start Point value.

The expressions I give you work properly. The original X value of the Start Point is used. The X value of the End Point is copied with the second expression.

I converted the Slider to a percentage of the comp panel height by multiplying it by 20 so you could easily use the slider to adjust the Start Point.

Did you try the expressions?

I changed the offset to 400, and the slider still works.

If you want to have the slider display pixels, remove the * 20 from the 'y' variable in the Start Point expression.

One more thing: yes, you could use the slider for both Y Points and add the Offset to the End Point, but it's cleaner to tie both End Point values to the Start Point and add your offset there. This makes editing the pair of expressions a little easier.

Layer/Transform/Position is the only property that allows you to separate dimensions, but doing so comes with a heavy price. Separate Dimensions removes the ability to edit the Motion Path in the Composition Panel. The easiest way to accurately create a motion path is just to set a couple of position keyframes and then use the Pen tool (g) to add additional points and create curved paths.