2

I have a layer called Blue.

I applied CC Particular World to a ShapeLayer with an animated separated X Position (with 3 keyframes).

The thing is that the effect doesn't move along with the shape. So either I animate the Producer features "Position X" with keyframes or I would parent this feature to xPosition.

I just don't know if this is possible and if so how?

I invented this script...

    thisComp.layer("Blue").effect("CC Particle World")("Position X").transform("xPosition")

it results in error!

Thank you for your help.

H.

3

There's no property called xPosition, and transform is a property of a layer, not a method, but you're on the right track. The expression has to return an array of two values [x, y], and the components of the position are stored in an array like that too. The expression you want — if you're applying it to the layer position property — is this:

xpos=thisComp.layer("Blue").effect("CC Particle World")("Position X");
ypos=transform.position[1];
[xpos, ypos]

That will apply the value of the Position X property of the effect to the X position of the layer, and the current Y value of the layer to the Y.

If you're trying to use the layer's X position on the effect's Position X property then you need to use:

thisComp.layer("Blue").transform.position[0]

you only need one value for this property.

Pro Tip a great way to learn how properties are accessed in expressions, as well as being a super quick and typo-free way of creating them is to use the pickwhip. Next to the expression box you'll see a curly icon. Click that and drag it to the property you want to reference in your expression. So in the second case you could drag it to the number for the X value of the layer's position and it would give you the correct syntax for accessing it.

enter image description here

A good place to learn more about expressions is Dan Ebbert's page: http://motionscript.com/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.