I'm kinda new to After Effects and I'm having a hard time creating a slider that I can control to move the chat windows with the same distance. The chat windows will start at the center and only one would show up. When I move the slider, it will show up the remaining 6 chat windows. I wanted for them to have the same distance and have the flexibility to use the slider. Here's an image of what the chat windows would look like if I move the slider.
1 Answer
Here's a way to do it
Put a slider on your middle layer Add the following expression to the middle layer's position control:
xval = transform.position[0];
yval = transform.position[1];
x = xval + effect("Slider Control")("Slider");
y = yval + effect("Slider Control")("Slider");
[x,y]
Then put this on your bottom layer's position control:
xval = transform.position[0];
yval = transform.position[1];
x = xval + thisComp.layer("middle").effect("Slider Control")("Slider")*2;
y = yval + thisComp.layer("middle").effect("Slider Control")("Slider")*2;
[x,y]
Then animate the slider value.
This adjusts the x and y position of the middle image by the amount on the slider. And doubles that amount for the bottom image.
-
Thank you tomh.. I'll be using multiple chat windows for the animation and maybe use the pick whip tool to link the chat windows.. but I'm still quite new to expressions and I'm not quite sure what the code below is for: xval = transform.position[0]; yval = transform.position[1]; [x,y] does this control the direction where the object moves? I've tried changing the value for transform.position but it displaces the object and no longer at the center. Thank you for the help though Commented Nov 14, 2021 at 9:08
-
The Xval and yval things are just to keep your original position values (there might be a better way to do this, not sure). There’s a good tutorial for beginning expressions here: schoolofmotion.com/blog/…– tomhCommented Nov 14, 2021 at 9:27
-
Thanks for the help.. I'll do some experimentation and see if I can achieve what I want.. thanks again, this helped me a lot Commented Nov 14, 2021 at 9:59
-
If you have lots of layers to animate, you may want to use the index command to control the multiplier, instead of manually changing the multiplying value in each layer. See this tutorial for info: rocketstock.com/blog/…– tomhCommented Nov 14, 2021 at 10:36