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

After Effect Expressions

Community Beginner ,
Jul 25, 2024 Jul 25, 2024

Hi, I have a shape layer with:

- A group containing a Horizontal Rectangle and Circle placed on the far right of the rectangle, the anchor point of the group is place far left of the rectangle

- A have a second Rectangle outside the group, a vertical Rectangle this time place on the far right of the first rectangle (Perpendicular), same as the position of the circle in the first group earlier

 

I'm trying to rotate the first group (remember i shifted the anchorpoint) and also want the second rectangle to follow through and the first group as if it were parented to the first group

 

What expression can i use to solve this issue

 

Thank you for feedbackScreenshot 2024-07-25 155434.png 

TOPICS
Expressions
478
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2024 Jul 25, 2024

You don't need an expression. Just select Group 1 and Rectangle 2, then create a new Group. This will give you a new set of transform controls for the entire group, and it only takes about 5 seconds.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 25, 2024 Jul 25, 2024

I actually have more complex shape layer where grouping it will make it more complex, i just used the one above as a sample.

Is there an expression that can solve it

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2024 Jul 25, 2024

The expression will not be simple. It needs to examine all the groups and objects you want to manipulate, gather the appropriate position and anchor point data, and then calculate the correct offset. To develop the expression, I would have to see a screenshot showing all the modified properties of everything in the shape layer you want to move. Some values may include the values from other objects, some may have to be subtracted, and others may be added.

 

I also need to know which object or group will be the master rotator.

 

The easiest way to do what you describe is to put everything you want to rotate in a new group and position the anchor point where you want the center of rotation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 25, 2024 Jul 25, 2024

Okay, Can you help me with an expression that can solve the sample problem earlier

Let me use it as a starting point for the complex shape. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2024 Jul 25, 2024

I will need to see the modified properties in the comp. Select the shape layer, press uu, and then share a screenshot.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2024 Jul 25, 2024
LATEST

If you want to animate Group 1/Transform Group 1/Rotation and automate the placement of the other objects (Rectangle 1 and 2), as long as all of the other properties are at their default settings, you can tie the Transform Rectangle 1/Anchor Point and the Transform Rectangle 1/Anchor point to the ellipse size with expressions, then tie Transform Rectangle 2/Position and Rotation to the Group 1/Transform Position and Rotation.

 

Here are the expressions:

//Transform Rectangle 1 Anchor Point
ElipseSize =  content("Group 1").content("Ellipse 1").content("Ellipse Path 1").size;
Rec1Size = content("Group 1").content("Rectangle 1").content("Rectangle Path 1").size/2;
[Rec1Size[0] - Rec1Size[1], Rec1Size[1]-ElipseSize[1]/2]
//Transform Rectangle 2 Anchor Point
refAP = content("Group 1").content("Rectangle 1").transform.anchorPoint;
[refAP[1], - refAP[0]]
// Transform Rectangle 2 Position
content("Group 1").transform.position
// Transform Rectangle 2 Rotation
content("Group 1").transform.rotation

If Rectangle 1 is not horizontal and Rectangle 2 is not vertical, you'll have to change both expressions or add an if statement to the expressions to figure out where to center the rotation.

 

I made the ellipse a vertical oval to make it easier to see it rotating. If your rotation center does not have equal sides, you will have to modify the expression to put the edge of the rotator against the edge of the rectangles or add another if/else statement. 

 

This is probably one of the simplest ways to link the layers with expressions instead of grouping them. Throw in 40 shapes that you want to link in various positions, and you can easily run into a very big mess in a very big hurry.

 

Here is what that looks like:

RickGerard_0-1721971190307.gif

I have included an AE 23 project file with the post.

 

 

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