Skip to main content
Inspiring
May 2, 2023
Answered

Adding a path to a group of contents gives an error

  • May 2, 2023
  • 2 replies
  • 461 views

I currently have a layer that has an effect "Start"

I have another layer where I have a Fill.

In the file I have an express with some code part of the code is a start point:

 

start = thisComp.layer("Control").effect("Start")("Point")[1];

 

In another layer I have a group of imported itmes from illustrator.

It contains:

In Contents I added a path and also added the express with the start code.

In this layer it gives me an error:

Error: Object of type not found where a property is needed

Is there a difference in the way that a fill layer and the vector group layer if treated? If so how can I set the start point of this object also?

This topic has been closed for replies.
Correct answer Karthik balaji

It sounds like you're trying to reference a layer within a group in After Effects using an expression, but you're encountering an error.

When you have a group of vector shapes in After Effects, the group itself is treated as a layer, and the individual shapes within the group are treated as contents. So in order to reference a path within a group, you need to specify the index of the group layer followed by the index of the shape within that group.

For example, if you have a group layer named "Group 1" and a shape within that group named "Shape 1", you would reference it in an expression like this:

thisComp.layer("Group 1").content("Shape 1").path


To set the start point of a path within a group, you can modify your expression like this:

 

start = thisComp.layer("Control").effect("Start")("Point")[1];
thisComp.layer("Group 1").content("Shape 1").path.points()[0] + start

 

This expression will add the value of the "Start" effect on the "Control" layer to the first point in the path of "Shape 1" within "Group 1".

Note that you may need to adjust the index numbers in the expression based on the order of your layers and shapes. Also, make sure that the "Control" layer is above the layer with the group of shapes in the layer stack so that it is properly referenced in the expression.

I hope this helps!

 

Karthik

2 replies

Karthik balaji
Karthik balajiCorrect answer
Participating Frequently
May 2, 2023

It sounds like you're trying to reference a layer within a group in After Effects using an expression, but you're encountering an error.

When you have a group of vector shapes in After Effects, the group itself is treated as a layer, and the individual shapes within the group are treated as contents. So in order to reference a path within a group, you need to specify the index of the group layer followed by the index of the shape within that group.

For example, if you have a group layer named "Group 1" and a shape within that group named "Shape 1", you would reference it in an expression like this:

thisComp.layer("Group 1").content("Shape 1").path


To set the start point of a path within a group, you can modify your expression like this:

 

start = thisComp.layer("Control").effect("Start")("Point")[1];
thisComp.layer("Group 1").content("Shape 1").path.points()[0] + start

 

This expression will add the value of the "Start" effect on the "Control" layer to the first point in the path of "Shape 1" within "Group 1".

Note that you may need to adjust the index numbers in the expression based on the order of your layers and shapes. Also, make sure that the "Control" layer is above the layer with the group of shapes in the layer stack so that it is properly referenced in the expression.

I hope this helps!

 

Karthik

Dan Ebberts
Community Expert
Community Expert
May 2, 2023

What is it that you're trying to do?