Welcome back to Animated Loops. In this part,
we're going to add a scrolling background to the run cycle that we created in
the last part.
We'll learn about parallax scrolling and also how to have multiple characters
moving forwards through a scrolling scene. Let's get started.
I've created a 1920 by 1080 composition just to give us a wider
scene and more space for a background.
I'm animating a 72 frame loop starting from zero,
which means that's our 24 frame run cycle loops three times.
We have our character composition from the first lesson in this composition.
Inside this composition,
set the background layer to a Guide layer so that it won't be visible in the
scrolling scene.
The first thing we're going to do is create a null as a guide for the scrolling
speed of the ground below the character. Name
this GroundMove.
Select the Position and separate the dimensions because we're only going to
animate the X Position.
Then let's go to the first frame where the foot is flat on the ground,
which should be the second frame, and move this null below the foot.
You can pick any point to track, but I'm going to use the heel.
Set an X Position keyframe here.
Scroll forwards through the frames to the last frame where the foot is still
flat on the ground and move the X Position back to the same point on the
foot as before. Now if you cycle through the frames,
the null should stay attached to the foot between the keyframes. Alt- or
Option- click on the X Position Stopwatch,
and we're going to add a loop Out expression,
but we're also going to add an extra Offset attribute to this.
What this does is loop the animation while maintaining the Offset Position at
the last keyframe so the null will just keep on moving further at the same speed
forever. This expression loops after the keyframes,
so move them back to the Start frame as zero. In a parallax effect,
objects that are closer to the camera should move faster and the difference in
speed should be directly relative to the distance. As we're working in 2D,
the distance will be represented by the Scale,
so we're going to create a new null to control that. Name this GroundScale.
We want this to be at the horizon of our scene. In
this composition, that's in the middle. But if your scene is different,
then just move the GroundScale null up to align with your Horizon
and parent GroundMove to GroundScale.
Then duplicate both of these nulls,
rename these to GroundScaleFront1 and GroundMoveFront1.
On GroundMoveFront1,
delete the expression and keyframes from the Position and add a new
expression using the Pick Whip to connect this null's X Position to
GroundMove's,
because we're going to use GroundMove's Position to control the speed of the
entire scene. Now we'll add some scenery starting with a Path.
Create a new composition, which is going to be a rock on the ground,
it can be quite small around 200 by 150.
And now create a simple rock using Shape layers.
I'll speed this up as how you do it isn't really important.
Just make sure you draw it from the same perspective as the rest of your scene,
which mainly means making the shadow the same shape as the character's.
Okay,
now drag in this rock composition into the main scene.
Move the Anchor Point to the bottom, parent the rock to GroundMoveFront1.
Then scale it down if needed.
We want the bottom of the rock to be vertically aligned to the GroundMove null
as this is where the floor is. Now,
we're going to scale up GroundScaleFront1 to around 115,
this will make the rock move slightly faster than the speed of the feet as the
rock is closer to the camera. Now,
we're going to make a line of rocks across the screen for the front edge of a
path that's our character is running along.
Set the rock layers to Continuously Rasterize,
which is usually a good idea for vector layers. Then
just keep on duplicating these rocks,
sliding them across while holding Shift to keep them vertically aligned,
then adjusting the Scale, too.
You can make the spacing and size whatever you like.
You just want there to be some variation as objects that are equally spaced and
the same sized can create some strange effects when scrolling quickly.
Now we have a line of rocks moving past the character,
but we want these to loop. So go to the Start frame and select all of the rocks,
duplicate them, on frame 0 unparent them from the null,
move
to the End frame and reparent them back to GroundMoveFront1.
That creates a looping animation, but you may have a gap in the middle,
so duplicate a few more of these rocks to fill in the gap.
They shouldn't be visible at the loop point,
so their Position isn't as important. Now
we have a full line of rocks.
I like to color code each of the different planes in scenes like this,
so select all of the rocks and the nulls they're attached to and pick a color
for these layers.
This just helps to stop things getting confusing when you have a lot of layers.
Then duplicate all of these layers, move them below the Character layer, rename
these GroundScaleBack1 and
GroundMoveBack1. Then
reduce the Scale of GroundScaleBack1 to around 85% as
this is the back edge of the path.
And you can see this line is scrolling and slower than the speed of the feet
because it's further away creating an almost 3D effect.
These back rocks are all perfectly aligned with the front row,
so we want to offset these.
Select all of the rock layers below the character and move them over to the left
while holding Shift to keep them aligned to create a bit more variety in the
scene. At the Start frame you can delete any rocks which aren't visible now.
Then go to the End frame to check which rocks we need to copy from the Start.
You
can lock the Character layer to avoid selecting them,
then select all of these additional rocks on the Start frame,
duplicate those, unparent them.
Go to the End frame and re-parent it them to GroundMoveBack1.
Now we should have two perfectly looping lines of rocks moving at different
speeds.
We'll also color-code the back line of rocks.
Now we're going to add more layers of scenery by adding some trees.
Create a new composition. Make this around 500 by 800.
Again, how you do this isn't particularly important,
just create it using vector Shape Layers so that it can be scaled up to
different sizes without losing quality. I'm
using a mixture of ellipses,
three-points polygons and rectangles to build my tree.
And
I use a Subtract Mask at the bottom of the tree trunk to give the effect that
it's growing out of grass.
Okay. Back in our main scene,
duplicate GroundScaleBack1 and GroundMoveBack1
for another row behind the back.
Go back to the Start and drag in the tree composition.
Set this to Continuously Rasterize,
move the Anchor Point of the tree to the bottom of the trunk.
Then align the Position to GroundMoveBack2.
Then we can scale the tree up
and parent it to GroundMoveBack2, then scale down GroundScaleBack2.
Adjust
the Scale of both these layers until it looks okay.
The tree should be just behind the back row of rocks.
Now we have a tree moving in the background slower than everything else.
Let's move this tree over to the side and Duplicate it to create a line of
trees. Place them on each side of the character.
Then at the Start, duplicate these trees, unparent them,
go to the End frame and re-parent them to GroundMoveBack2.
It's looking good so let's also color-code these layers.
Duplicate them all, move them below and give them a different color.
Then reduce the Scale of GroundScaleBack3 even more so they're further
in the background.
Move the Position of the tree layers over so they're all in frame.
Then duplicate them, unparent them at the Start frame,
go to the End frame and re-parent them to GroundMoveBack3.
Now we're going to add another layer of trees in the foreground.
Select all of the layers for the row of trees at the top.
Duplicate them and move them to the top of all the layers,
and give them a different color. As these are in the front, we
named them GroundScaleFront2 and GroundMoveFront2.
And scale up GroundScaleFront2 so the trees are in front of the scene.
I want to see more of the character so I'm going to delete a couple of the
trees. This one at the Start frame.
And
this one at the end.
And I'm going to remove the horizon so the background is all one color.
There you have a scrolling loop with accurate parallax scrolling all controlled
by two keyframes on one layer. You could leave this there,
but sometimes you want your character to be running past the screen.
If you do this on a static background,
then the loop feels very static because there isn't much movement.
And also a running character is often moving so fast that you don't get a chance
to see them clearly.
A way around both these issues is to have the character moving through a
scrolling scene with the character moving faster than the background is
scrolling. If you go back to the Start,
let's duplicate our original GroundScale and GroundMove nulls.
Move these above the character,
rename them CharacterScale and CharacterMove.
Parent
the character to CharacterMove. Make these layers all the same color.
Show the CharacterMove Position, select the keyframes,
and in Keyframe Assistant, select Time Reverse Keyframes.
This makes our character move the same speed as the background but in the
opposite direction,
which means they're currently moving twice as fast as they need to be.
So show the Position for GroundMove2,
the keyframes should now be five frames apart so double the length and extend
them to 10 frames.
Then extend the whole work area to double the length, too,
which is going to be at 144 frames, with
the End marker here and the end of the work area one frame earlier.
Go back to the start, duplicate the character, unparent them.
Then at the End, re-parent them to CharacterMove.
Now we have a scrolling background moving half the speed as before,
but with the character moving the same speed in the opposite direction.
Having a gap like this isn't great for maintaining momentum,
so let's add some more characters.
Duplicate both these characters,
then adjust their position so they fill the gap.
I also want to adjust the timing of these by moving them three frames earlier.
This goes back to the rhythm tip from lesson one where it's best to not have
different characters all moving perfectly in sync.
Now we can create even more characters running further back.
Duplicate all of these Character layers.
And move these between the back rows of trees.
And give them a new color.
Reduce the Scale of CharacterScale, too,
so the characters are running between the two rows of trees behind.
I
also want to adjust the Position of these so they're a bit more evenly-spaced
between the front row of characters. Then at the End,
there's a character here who isn't visible at the Start,
so duplicate that character at the End frame, unparent them,
go back to the Start and re-parent them to CharacterMove2.
Then select all of these new Character layers and shift them six frames earlier.
Now we effectively have four different characters moving through the loop,
but all with evenly-spaced timing, three frames apart,
which helps to create a constant flow through the character movement.
The final tip is for scenery very far in the distance.
I'll quickly create a cloud with Rounded Rectangle Shape layers,
make this white and move it in the sky at the top of the scene.
Then move that layer to the bottom above the background.
Then duplicate the Bottom2, Scale and Move nulls,
give these and the cloud a different color, make
the size of the Scale null very small because this is very far away.
Parent the cloud to that. Then duplicate that cloud at the Start, unparent it,
move to the End and re-parent it to GroundMoveBack4.
You'll see that because the clouds are so far away,
you'd need to create a line of clouds all very close together for it to loop
properly, which won't look very good. Instead,
you can use the foreground trees,
which pass by to reset the Position of the clouds when they're hidden.
So when the first cloud disappears behind the tree,
end that layer in the Timeline and on the next frame set the Start of the other
cloud layer. Then if you play the loop,
the changing position behind the tree isn't that noticeable and it looks better
than just having static clouds in the background. But for this loop,
I prefer it without, so I'll hide the clouds.
And this is where I'll end the loop for this lesson.
I'll see you in lesson five. Thanks for watching.