After Effects Tutorial: Make a Realistic, Elastic Spider Web - 360

Octopus Effects
274 followers
23 Video Views·Dec 31, 2024
Learn how to create a realistic Spider-Man web-slinging effect in After Effects! This tutorial covers everything from creating the web shape to adding movement and elasticity. Perfect for beginners and experienced users alike.
Code:
//Change this 3 values to change the effect
freq = 5;
decay = 7;
mult = 0.05;
if (numKeys > 1 && time > key(2).time){
t = time - key(2).time;
a = velocityAtTime(key(2).time-.01)[0];
d = a*mult*Math.sin(t*freq*Math.PI*2)/Math.exp(t*decay);
value + [d,d]
}else{
value
}
Ever dreamed of being Spider-Man?
In this video, I'll show you how to create realistic web-slinging effects right inside After Effects.
This tutorial is divided into five parts.
Part 1. Creating the spider web.
As usual, start by creating a new composition.
Add a solid layer,
and use the pen tool to draw a spider web-shaped mask on the solid.
Remember, to create a new mask, click outside the viewer window,
and After Effects will understand that you've finished the current mask.
Next, we'll use Saber to reveal the masks and create a web-like effect.
For those who don't know, Saber is a fantastic free plugin by Video Copilot.
Set the core type to layer masks.
I've set the glow intensity to 1%, just enough to see a faint colored outline.
The distortion amount is 15, which gives us smaller lines surrounding the main web-strands.
Both wind speed and noise speed are set to 0.
The core size determines the thickness of the web-strands.
Part 2. Animating the web-shooting out.
Use the puppet tool to pin down key points of the web,
points that will influence the deformation of the entire web.
I'll add two more pins on the inside to create the web's elasticity effect.
In this shape, the web has already finished shooting out, so I'll move these keyframes back.
Before the web is launched, all the pins are in one place.
Now, let's create the elasticity effect on those two inner pins.
I've prepared a code snippet, and I'll explain each line in detail at the end of this video.
For now, I'll copy and paste this code into the position property of both elastic points.
You'll see these points oscillate like a spring before coming to a complete stop.
The strength of this oscillation depends on the point's velocity.
If I extend the keyframes, the speed decreases, and you'll notice the elastic oscillation weakens.
Now, if I shorten the animation time, the speed increases, and the oscillation becomes very strong.
The initial setting seems just right to me.
Part 3, animating the web retracting.
Set keyframes for all the pins here.
This is the starting point for the retraction.
At this moment, the starting point and middle points have retracted a bit,
but the sticky part of the web hasn't detached yet.
Here, everything retracts completely.
Now let's take a look at the result.
Looks pretty good, right?
Part 4, creating and animating text.
In this part, I'll create the word spider, which will be pulled by the web as it retracts.
At this point, the word will detach from the web and oscillate before settling in the middle of the screen.
When the web starts to retract, the word is off-screen.
Now paste our magic code into the position property of the spider text.
The text now has a spring-like motion, but wait, it's not moving in the right direction.
You see, I need to adjust it slightly.
Add a minus sign before the Y value.
Now it's moving in the correct direction,
but I need to double the movement along the X axis to make it look more natural.
What do you think?
Perfect, right?
Let's add some motion blur to make everything look more realistic.
Now let's delve into our magic code.
This is the code we have.
When I highlight a line of code in yellow, that line is being explained.
This sets the frequency of the spring oscillation.
A higher value means faster oscillations.
This determines how quickly the oscillation dampens or fades out.
A higher value means faster decay.
This is a multiplier that adjusts the amplitude or intensity of the oscillation.
This checks if there are at least two keyframes on the layer.
This checks if the current time is after the second keyframe.
If both conditions are true, the spring effect is applied.
This calculates the time t that has elapsed since the second keyframe.
This retrieves the initial velocity, ua, of the layer at the moment just before the second keyframe.
It takes the X component of the velocity.
This is the core calculation for the spring effect.
Creates a sine wave oscillation over time.
Multiplies the sine wave by the initial velocity and the multiplier to adjust the amplitude.
Divides by an exponential function of time and the decay value to dampen the oscillation over time.
The resulting displacement value caused by the spring effect.
This adds the displacement, d, to the current position value of the layer.
Since d is applied to both the X and Y axes.
If the conditions are not met, then the layer's position remains unchanged.
Overall functionality, the effect only activates after the second keyframe.
The velocity at the second keyframe is used as the initial velocity for the spring oscillation.
A sine wave oscillation is created with adjustable frequency and amplitude.
The amplitude of the oscillation decays over time due to the decay factor.
The layer's position is continuously updated based on the spring oscillation.
Thanks for sticking with me through this tutorial.
I hope you learned a lot and had some fun along the way.
Don't be a stranger and I'll catch you in the next video.
