Skip to main content
Participating Frequently
September 18, 2020
Answered

Wiggle expression

  • September 18, 2020
  • 3 replies
  • 3166 views

HI! I have a few layers and I want to wiggle their position. Also I have a null object with wiggle expression on its position. When I pickwhip their position to the position of null object these layers changing their position but I need only wiggle effect without changing the position. How do I achieve that?

Correct answer Szalam

I think what you want to do is parent your other objects to the null object instead of pickwhipping to its position.

3 replies

Community Expert
September 19, 2020

If you want to wiggle a bunch of layers at the same time and maintain their relative position you have two very simple options. Parent all of the layers to a null with wiggle() applied to it or Pre-compose all the layers and apply wiggle to the pre-comp. Most of the time I would use parenting. 

 

Using an expression would require you to retrieve the difference between the comp center and the position of the layer that is wiggling and add that value to the current layer's position. The expression would look like this:

 

src=thisComp.layer("Null 1").transform.position;
ofst = src - [thisComp.width/2, thisComp.height/2];
value + ofst;

 

The expression given by OussK does not work. You could remove the wiggle from the null and a layer containing the expression would still wiggle. Apply the expression to multiple layers and they would all wiggle differently.

Community Expert
September 19, 2020

I have an animation preset I call Parent Position to Master. All you have to do is change the layer name of the position only parent to Master. Feel free to download it and save it to your custom presets folder.

OussK
Community Expert
Community Expert
September 19, 2020

You can use this expression 

 

var mSource = thisComp.layer("Null 1");
var P1 = transform.position.wiggle(5,10);// this this you layer wiggle value:
var P2 = thisComp.layer("Null 1").transform.position;
var P3 = thisComp.layer("Null 1").transform.position.valueAtTime(mSource.inPoint);
P1+P2-P3;

 

change the Null 1 to your Null name, it will look like this

 

 

Szalam
Community Expert
SzalamCommunity ExpertCorrect answer
Community Expert
September 18, 2020

I think what you want to do is parent your other objects to the null object instead of pickwhipping to its position.