Highlighted

Sequence and repeat multiple different lines

Community Beginner ,
Aug 24, 2020

Copy link to clipboard

Copied

Hello,

 

logo.jpgI am trying to have a sound wave animate to simulate the wave a crowd makes in a stadium. The blue lines would animate up and the bottom lines would animate down both returning to their original position. This would happen in succession from left to right with a blue and a black line always animating simultaneously.

 

I am a beginner and have watched many videos and tried various methods (masks, repeaters...) but my newness is hampering me as I don't even know what to look for. 

 

Sequencing multiple layers (a lot of layers ;)) gives the best results but that's very time consuming and I would like to understand the efficiencies of After Effects.

 

Any advice is very much appreciated.  

Topics

Expressions, How to

Views

97

Likes

Translate

Translate

Report

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

Sequence and repeat multiple different lines

Community Beginner ,
Aug 24, 2020

Copy link to clipboard

Copied

Hello,

 

logo.jpgI am trying to have a sound wave animate to simulate the wave a crowd makes in a stadium. The blue lines would animate up and the bottom lines would animate down both returning to their original position. This would happen in succession from left to right with a blue and a black line always animating simultaneously.

 

I am a beginner and have watched many videos and tried various methods (masks, repeaters...) but my newness is hampering me as I don't even know what to look for. 

 

Sequencing multiple layers (a lot of layers ;)) gives the best results but that's very time consuming and I would like to understand the efficiencies of After Effects.

 

Any advice is very much appreciated.  

Topics

Expressions, How to

Views

98

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Aug 24, 2020

Copy link to clipboard

Copied

Read this, can it helpful:

Arrange layers in time sequentially

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Aug 25, 2020

Copy link to clipboard

Copied

Thank you Byron!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Guide ,
Aug 25, 2020

Copy link to clipboard

Copied

In AE, there are often more than one way to a result. Every way has its own pros and cons.

 

I understand your question so, that the blue and black lines shouldn't be there at the beginning. As time goes on, they are animating from button to top (blue) and top to button (black) to the length as seen in your screenshot. So, each line has a different length. And of course, this animation should be staggered in order to create a wave-effect.

 

I would solve this with expressions, shape layers and trim paths. 

 

First the artwork:

Recreate the first line as single path on a single layer in it's final appearance and add trim path animator.

The trim path has a starting value and a end value and an offset. One of those, start and end, can be used to trim the path on the desired side. It depens on where you set the first path point. Just drag the numbers and you will see.

Make sure that the path is not trimmed in the first place.

 

Next the rig:

Now we are going to create a rig to give functionality to this. I prefer to outsorce global animations, therefore create a null - layer and add a slider "driver" to it. Animate the slider from 0 to 100 to 0 in your favor.

And finally link the slider to the start/end property of trim path.

Now the line should animate synchronous to the slider animation - appear and disappear.

 

What we need to add now is a offset, which will automatic increase on each layer. For this, we need the layer index which is its number in the layer stack.

For finetuning, we also need a second slider. Add a second slider to the null and call it "offset".

Then go to the start / end property and edit the expression there:

 

    driver = *drag slider here*

    offset = *drag slider here*

    offsetFrames = offset * thisComp.frameDuration;

    offsetIndex = offsetFrames * index;

    driver.valueAtTime(time-offsetIndex);

 

First we grap the slider values. Next we convert the slider value from offset to your seconds-timebase. This way, you can set frames in the slider, instead of fractions of seconds which is not very handy.

Next we add the index. For the first layer, offsetFrames is the same as offsetIndex, but for the second layer, offsetIndex is already double of offsetFrames. We are creating the staggering here.

And the final line tells AE to use the values of driver at a certain time.

If you set the offset to 5 frames, the first line will follow the drivers animation 5 frames after.

 

Final duplication and line edits:

When everything is working as expected, the final step is to duplicate the shape layer. The expression is layer-independend and will work for every layer. There is no need to edit anything.

 

However - and if I get you right - the lines have all different lengths. So you need to edit the paths on each layer to meet your design. Since trim-path works with pertentages, the line length doesn't matter.

But a short line will animate longer than a fast line, since the animation time is always the same, but the distance does increase.

If you like to animate everything with the same speed, I have to overthink the expression. I will - just report back.

 

Once you are done with the blue lines, precomp everything and duplicate the precomp in project panel and place the new comp beneath the blue lines. Rotate if by 180° and add the effect "fill mask" to it to make everything black. Then step into it to edit the lines.

 

 

As I said, this is one way and as I understood your question.

Of course you can keyframe everything and stagger the layers but it's a hell of adjusting if you want to work out a timing.

 

Report back how things went.

 

*Martin

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Aug 25, 2020

Copy link to clipboard

Copied

Martin, Thank you very much! You're incredible for giving me such a detailed method.

 

Actually, the lines are all there as you see in the image I attached. The animation is that each line jumps up(blue) or down(black) by #px then returns to its original location within about 750ms. This happens from left to right in succession.

 

I will try this and let you know how it goes.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Aug 25, 2020

Copy link to clipboard

Copied

I think the easiest way to do this would be to create a matte for a shape layer with a single vertical line and a repeater. You could use the Create Nulls from Paths.jsx script that comes with AE to attach nulls to a closed path (a mask on a solid). Figure out how many curves you want, create that number of points on the mask, then tie the position of the middle nulls to the value of Both Sliders on the Audio Amplitude layer with each point delayed a little by time. I threw this together in about 15 minutes. there are only two sets of points between the start and end of the path and I delayed the top right and bottom right response by 8 frames to give me a wave. This is what the comp looks like:

Screenshot_2020-08-25 01.20.35_Q90whX.png

Here are the expressions for the top and bottom pair of nulls.

 

 

// Top set of nulls
timeFactor = (index - 1) * (thisComp.frameDuration * 8);
Amp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
t = Amp.valueAtTime(time - timeFactor);
tMin = 4;
tMax = 25;
value1 = 500;
value2 = 350;
y = linear(t, tMin, tMax, value1, value2);
[value[0], y]


// Bottom set of nulls
timeFactor = (index - 3) * (thisComp.frameDuration * 8);
Amp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
t = Amp.valueAtTime(time - timeFactor);
tMin = 4;
tMax = 25;
value1 = 500;
value2 = 350;
y = linear(t, tMin, tMax, value1, value2);
[value[0], y - 100]

 

 

The first line multiplies the index of the layer - 1 by the frame duration of the comp times the number of frames to set the delay. Because I put the top left null at the top of the comp the value of the time factor is 0 but on the second layer the time is 8 frames after the first layer moves. Did you follow that?

 

The second line of the expression defines Amp as the value of the Both Channels slider in the Audio Amplitude layer. The third line defines "t" as the Amp value at the adjusted time. Because the adjusted time for the top layer is the layer time the null is going to move when the Amp value changes, but the second null, on the second layer is not going to move until 8 frames later.

tMin and tMax are the minimum and maximum values of Both Channels generated by the audio file I added to the comp.

value1 and value2 are going to be the maximum and minimum values for Y.

 

A simple linear method directly from the Expression Language Menu/Interpolation choices gives me the Y value. Then a simple array completes the expression taking the current position of X and using the interpolated value for y.

 

The only difference between the top and bottom null layer expressions is the index - value. I set it to 3 so the bottom left null would react in realtime to both channels and the bottom right null would react 8 frames later. I also subtracted 100 from y in the bottom two nulls to establish a minimum thickness for the wave.

 

The last step was to just set up a simple shape layer with one vertical line with a 4 point stroke, add a repeater, and adjust the number of copies and the x offset. Set Matte was used to mask the layer using the Solid with the animated mask. You could also have just used a Track Matte. 

 

Duplicate this comp, change the color of the lines in the duplicate and adjust position and maybe scale, and maybe even offset the timing and put them both in a new main comp and you would have your design. To get the exact shape you are showing will take 10 points on the mask path and some tweaking of the Bezier handles. 

 

As I was finishing up this post I had another thought. You could use this same linear method idea to control Wave Warp and get a simpler effect. I think the most controllable design would be the animated path as a matte method I described here, but using Audio Amplitude to drive Wave World would be much easier to set up.  Both of these solutions are going to be a lot easier to set up and faster to render than trying to animate the length of a couple of hundred vertical lines.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Aug 25, 2020

Copy link to clipboard

Copied

Rick, Thank you very, very much. I can't tell you how much I appreciate this.

 

I had been trying to use a mask to do this but didn't know how to affect a single node or section of the closed path.

 

I am a beginner but will use this as an exercise and try to make this work.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Aug 27, 2020

Copy link to clipboard

Copied

This thread gave me an idea for a couple of animation presets. I added a controller layer with some sliders and cleaned up the expression. The workflow is to add an audio track to a new comp, use the keyframe assistant to convert audio to keyframes, add a shape layer with a Rotobrzier path with 4 or 5 points in a straight horizontal line starting from the left side of the comp, then add a null named Controller and apply the Controller preset, then select the Path in the shape layer and use the Create Nulls from Paths/Points Follow Nulls script to add a null for each point. Arrange the comp so the Controller layer is on top and the nulls are next. Then apply the nulls preset to all of the nulls created by the script. The last step is to adjust the number of layers in the controller slider and preview your comp. With the presets, you can generate a comp like this in about 3 minutes. Here are the two Presets: Audio Snake Controller, Audio Snake Nulls.

Screenshot_2020-08-27 00.29.13_kLZqTQ.png

Here is the expression for position on the null layers:

// Calculate X
ref = thisComp.layer("Controller").transform.position;
ofst = thisComp.layer("Controller").effect("Offset")("Slider");
numPoints = Math.floor(thisComp.layer("Controller").effect("Number of points")("Slider")) - index + 1;
x = (numPoints * ofst) + ref[0];
// Time delay
numFrames = thisComp.layer("Controller").effect("Frame Delay")("Slider") * thisComp.frameDuration;
timeDelay = numPoints * numFrames;
srcAudio = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
t = srcAudio.valueAtTime(time - timeDelay)
// Animate Y by Both Channels;
tMin = thisComp.layer("Controller").effect("tMin")("Slider");
tMax = thisComp.layer("Controller").effect("tMax")("Slider");
btmPos = thisComp.layer("Controller").effect("Bottom Line")("Slider");
topPos = thisComp.layer("Controller").effect("Top Line")("Slider");
y = ref[1] - linear(t, tMin, tMax, btmPos, topPos);

[x, y]

Here's a video of the comp working.

 

Enjoy... With a little work on your own, you could modify the presets and set them up for a closed path by creating a second set of controllers for the bottom path that drive a slightly different set of expressions. A very careful look at the expression should help you understand what I'm doing. 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
jbass524 LATEST
Community Beginner ,
Aug 27, 2020

Copy link to clipboard

Copied

Sir! You're amazing.

 

Although I am a beginner I feel this will be a great lesson for me in understanding how to get under the hood of Ae. Right now I can only do things at a beginner to maybe a low intermediate level.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...