Skip to main content
Known Participant
August 2, 2017
Answered

How to change position of multiple objects based on the scale of one

  • August 2, 2017
  • 2 replies
  • 5433 views

Hi

I am trying to make the outer ring of dots in the polygon below move away from the central point of the composition when the scale of the null object changes. The null object is changing its scale based on audio keyframes.

I wanted the dots to move in reaction to the audio and this is the only way I can think of to do this. When I pickwhip the position value of the dots to the scale of the null object they do what I expected and bunch into the top corner of the composition.

Any help would be much appreciated as I'm well and truly stuck at this point.

This topic has been closed for replies.
Correct answer Mike_Abbott

Hi Mike

Yes you are exactly right. I want the dots to move on an axis between the centre of the comp and their original position if this is possible. As they are positioned in a ring shape I want them to wiggle outwards using an axis from the centre of the comp and their original position, and I would like them to move in relation to the audio. My apologies for being somewhat vague.


OK, I was feeling generous... here's a solution - I hope ; )

This expression assumes that your dot layers are not parented to any other layer.

1. Audio  layer.  [menu] Animation > Keyframe Assistant > Convert Audio to keyframes.

2. Paste this expression onto your first dot layer position property:

audioMin = 0;

audioMax = 50;

maxMove = 100;

radius = 500;

audioAmp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

compCentre = [thisComp.width/2, thisComp.height/2];

objPos = thisLayer.position - compCentre;

Len = length(objPos);

Angle = radiansToDegrees(Math.atan2(objPos[1],objPos[0]))

move1 = linear(Len, 0, radius, 0, maxMove);

move2 = linear (audioAmp, audioMin, audioMax, 0, move1);

LenW = Len + move2;

objPos2 = [ LenW * Math.cos(degreesToRadians(Angle)), LenW * Math.sin(degreesToRadians(Angle))] + compCentre

NOTE:

You'll need to copy this to each of your dot layers - but before you do you, adjust the values on the first four lines:

audioMin = the minimum audio level to create any dot movement ;

audioMax = the maximum audio level to create dot movement ;

(look at the graph editor value graph for the audio amplitude 'both channels' property to decide on these values - vertical scale)

maxMove = the maximum amount of dot movement ;

radius = the radius of the outermost dot's position from comp centre ;

3. Once you've set the above values copy the expression to all the other dot layers.

Preview and report back.... : )

2 replies

Jose Panadero
Community Expert
August 2, 2017

You need to add the original position value of the points to the expression. Your expression should be like this:

temp = thisComp.layer("Amplitud de audio").effect("Ambos canales")("Deslizador");

[temp+value[0], temp+value[1]]

Anyway, i think this is not what you are looking for. I think the best way to do this is to link the outer dots to a new null object via parenting, and link the scale of this new null to the scale of the "Central Pulse" layer via expression.

grantM80Author
Known Participant
August 2, 2017

Thanks Jose

This is pretty much what I'm trying to do. So do I need to apply your expression to the central pulse layer and then add the values for the individual dots?

Jose Panadero
Community Expert
August 2, 2017

The expression is only to apply to individual dots in case you don't link those dots to a new null. But I think the offset will be always in the positive ranges of position values so i'm not sure this is what you need.

The second way to do it is to link the outer dots to a null, then link the scale of the null to the audio keyframes in the Audio Amplitude layer.

P.M.B
Brainiac
August 2, 2017

If i'm understanding you correctly you need to pre-comp the dots or parent them to a single null so they are one unit and then parent that single unit to the scale.  Think about it, you are pick whipping position in x & y to scale in x, y.  The scale is a value of 90 in x and y.  Show your rulers and find the 90,90 point on the screen.  It's in the upper left hand corner.  Basically scale interpolates differently than position.  Position originates at the upper left of the comp and increases right & down.  Scale originates at the anchor point of the layer and radiates outward.

~Gutterfish