Category Archives: blog

Path Anatomy

Manipulating and visualizing path properties using expression

NOTE: AE CC 2017 or later is required

Initial Path

We first create a simple path animation using a shape layer. This will serve as a base path for our exercise. The position of the shape layer has been set to 0,0 in order to simplify our expressions.

Arbitrary initial path

The timeline looks like this:

Initial timeline

Recreating the path

We would like to recreate the initial path using a path expression applied to a new shape layer. This is done with the following expression:

myPath = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path;
pts = myPath.points();
inTans = myPath.inTangents();
outTans = myPath.outTangents();
closed = myPath.isClosed();
createPath(pts, inTans, outTans, closed);

The initial path was using Fill only, so we use Stroke only for the replicated path. We also set the layer’s position to 0,0. The timeline looks like this:

Recreating the path using expression
The new path (black stroke) exactly matches the initial path (blue fill)

Traveling Along The Path

We would like to create a dot that travels along the path. We want the animation to span the entire comp duration: the dot should start its journey at t=0, and it should reach the end of the path at the end of the comp.

The dot is represented as a small filled and stroked ellipse:

Traveling along the path

We use the following ellipse position expression to make the dot traveling along the path:

myPath = content("Create Path").content("Path 1").path;
animDur = thisComp.duration;
travelProgress = time / animDur;
pt = myPath.pointOnPath(travelProgress);
Point on path

Visualizing Tangent Along The Path

We would like to visualize the tangent vector at the traveling point. To this end, we add two new shape groups for the in and out tangents:

Creating shapes for the in and out tangents

We add the following path expression to create the in tangent vector as a simple straight line of given length:

myPath = content("Create Path").content("Path 1").path;
animDur = thisComp.duration;
tgLen = 60; // length of in tangent in px
travelProgress = time / animDur;
pt = myPath.pointOnPath(travelProgress);
tg = myPath.tangentOnPath(travelProgress);
inTanPt = pt - tg * tgLen;
verts = [pt, inTanPt];
createPath(verts, [], [], false);

The expression is the same for the out tangent except the vector points in the opposite direction:

...
outTanPt = pt + tg * tgLen;
verts = [pt, outTanPt];
...
Visualizing the tangent along the path

Visualizing Normal Along The Path

To finish our exercise we would like to visualize the normal vector at the traveling point. We first add a new shape group:

Creating shape for the normal

Then we apply the following path expression:

myPath = content("Create Path").content("Path 1").path;
animDur = thisComp.duration;
nrmLen = 35; // length of normal in px
travelProgress = time / animDur;
pt = myPath.pointOnPath(travelProgress);
nrm = myPath.normalOnPath(travelProgress);
nrmPt = pt + nrm * nrmLen;
verts = [pt, nrmPt];
createPath(verts, [], [], false);
Visualizing the normal along the path

Conclusion

Through this little exercise we have seen all path properties available in expression. We were able to create a path by specifying its vertices and tangents, and were able to visualize tangent and normal vectors of a point traveling along the path. Hope you find it useful!

You can also check ConnectLayers PRO, a tool that create lines that are dynamically linked to the layers using powerful path expressions. No keyframes at all!

Trim Path Tricks

Attaching a layer to the end of a path using expression

NOTE: AE CC 2017 or later is required

Start Simple

We first create a simple horizontal path using a shape layer. We make sure to set the layer’s position to 0,0 so the coordinates of the vertices will correspond to points in comp space (this will simplify a little bit our expression).

Start with a simple horizontal line

Then we add a Trim effector and create two keyframes to animate the end of the path from 0% to 100%. For the second key, we apply an Easy Ease In and multiply the influence of the incoming velocity by two (i.e., from 33.33% to 66.66%).

Now we create the layer we would like to attach to the end of the path. We make sure its position corresponds to the center of the comp (the default value) and its anchor point is located at the left hand side of the layer.

The layer to be attached to the path

The timeline looks like this:

Simple setup

To attach the layer to the path, we need to find the location (in comp space) of the end point of the path. This is done with the following position expression:

shapeGroup = thisComp.layer("Path Layer").content("Shape 1");
myPath = shapeGroup.content("Path 1").path;
trimEnd = shapeGroup.content("Trim Paths 1").end / 100;
endPt = myPath.pointOnPath(trimEnd);
The origin of the layer is “pushed” by the end of the path

Add Salt

Let’s see if we can add a small gap between the end of the path and the attached layer. Since our path is a straight horizontal line, we only need to shift the layer to the right along the x-axis. We add the following code to the previous expression:

...
gap = 15; // distance in px between the path and the layer
endPt + [gap,0];
Adding space bewteen the end of the path and the layer

Add Pepper

Now we would like to try with a more complex path, say an arbitrary Bezier path. Note that the end vertex has a non-zero tangent vector.

A more complex path

The code for the gap must be changed to take into account the direction pointed by the path (i.e., the tangent vector at the end of the path):

...
gap = 15; // distance in px between the path and the layer
tg = myPath.tangentOnPath(trimEnd);
endPt + gap * tg;
Adjusting the gap code

Add Cayenne Pepper

Now we would like to rotate the layer so it’s oriented along the path. To this end, we could use the corresponding built-in feature in AE:

Built-in auto-orientation along the path

Not that bad, but notice how the layer suddenly changes its orientation at the end of the animation. So let’s try to orient the layer using the following rotation expression (don’t forget to turn Auto-orient off before applying the expression):

shapeGroup = thisComp.layer("Path Layer").content("Shape 1");
myPath = shapeGroup.content("Path 1").path;
trimEnd = shapeGroup.content("Trim Paths 1").end / 100;
tg = myPath.tangentOnPath(trimEnd);
a = Math.atan2(tg[1],tg[0]);
radiansToDegrees(a);
Custom auto-orientation along the path

Great, the orientation looks correct now.

Cake For Dessert

For better control we could precompose our layer and make some design changes in the precomp. We don’t want the (precomp) layer to overlap the end of the path so we position the content of the precomp at the center of the precomp, and left-align the content since our path animation goes from left to right.

Working with a precomp
Using a precomp provides more control

Conclusion

We have shown how to attach a layer to the end of a path using simple expressions. Hope you find it useful!

If not, you can use or tool Connect Layers Pro to add arrow heads to your path!

A Newton mini tutorial by Joyce N. Ho

Joyce N. Ho is a Hong Kong born, Australian designer, based in New York City.

In 2019 she designed an  animated poster for San Francisco Design Week using Newton

Here’s the final video:

“I created a motion poster for @sfdesignweek this year, on the theme of “CommUNITY”. My design is inspired from the idea that we come together to comfort, collaborate and communicate with each other – to be part of something bigger than ourselves.

And she also created the very interesting Newton mini tutorial to reveal the technical process behind the animated poster!

As an example, she create a null object that will control the gravity with random values inside Newton!
She also used the magnet system and different simulations assemble in a final composition.

Very interesting!

Thank you Joyce!

Want to ask something? Contact us!

apply a mask on an Illustrator layer in After Effects

Dealing with Illustrator files and shape layers in Newton

You may know that you can use Adobe Illustrator files with Newton for Adobe After Effects. You can do this by using different techniques like converting them into shape layers.

It’s important to know that the more your objects are complex, the slower your simulation will be.
Also, you won’t get better results if you use complex objects in your simulation. And by complex, we mean plenty of path vertices and detailed Bezier curves.

So, what are the best practices?

Use a mask

 

You can apply a mask to your Illustrator layer so Newton can interpret its outline correctly.
You can also use the auto-trace function of Adobe After Effects.
If you copy/paste the path from Illustrator, you should use before the “Simplify” and “Cleanup” function in Illustrator to have the most optimized shape.

Note that here, what’s inside the robot has been removed since we don’t need it for the simulation. The mask only cover the outline of the artwork.

apply a mask on an Illustrator layer in After Effects

Converting your Ai files to shape layers

 

You can convert your Ai file to shape layers.
But be sure to ONLY send to Newton what’s needed. You can simply hide the path or the groups that you don’t want to use in Newton and unhide them after the simulation is complete.
In this example, mouth and eyes are not needed for the simulation and will be unhidden after the simulation is complete.

Also, always try to simplify the transformation applied to your shapes. In most cases it is recommended to have the inner transform  of a shape (transform properties of groups for example) set to the default values and use layer’s transform instead.

Watch for self-intersecting shapes!

 

Newton prevents to load shapes and masks that have self-intersecting path or orphan vertex. It will warn you if one of the paths cannot be correctly interpreted. You’ll then have to manually modify it.
Be careful when working with paths created using tools like the cutter tool in Ai!

Creating proxy version
of your objects

 

Best pratice to use complex Ai vectors is to replace them by a less complex version of them and simply parent them to the original ones.
Just like in this breakdown.

Need more tips and tutorials?
Check our Learn page!

Tutorial: Textless effect

A tutorial to achieve the amazing effect where the content of a sign is falling drove by physics.

Tutorial: Fill-Mix-Flush using Newton3

A classic case of animation which uses physics intensely!

Interview(s)!

Our friends from Motion Café invited us on their show to talk about our history, our products and do some demos.

Newton2 and macOS 10.5 Catalina fix

So, you have upgraded to the last version of macOS 10.5 Catalina. But suddenly when you launch After Effects you get that message that tells you that you cannot run Newton.

Now, the bad news:  support has been dropped for Newton2.
The good news, you can still use it with macOS 10.5 Catalina, here’s how!

→You can use aescripts manager to install it and register

→Or you can go to your security preferences into macOS to allow Newton2 to run it (more info here):

– You have to launch Adobe After Effects and macOS will say that Newton2 is not signed.
-Click cancel
-Go to your security preference.
-MacOS will ask you if you want to run Newton2.
-Click Open Anyway

Fixed!

Note that if you have the same message with Newton3, you just need to download and update to the last version.

Or you can upgrade Newton and get up-to-date features!

 

Need more tips and tutorials?
Check our Learn page!

Tutorial: Textless effect

Remember the amazing “Textless” short by Gareth Smith & Jenny Lee?
Well, here’s our own tutorial that recreates the workflow to achieve this amazing effect where the content of a sign is falling drove by physics.
We are going to use Adobe After Effects, Mocha AE to track the sign and Newton3 for the physic simulation. Adobe Illustrator to vectorize the artwork and Adobe Photoshop to clean up the sign using the content aware tool.
That’s a lot of tools for an amazing result. But don’t worry, everything is going to be quite easy to do.

“Textless” by Gareth Smith & Jenny

If you need more in depth about the tracking with Mocha AE, check the great tutorial of Mark Christiansen at School Of Motion:

Get Newton for Adobe After Effects: https://aescripts.com/newton/

Link to the video used in this tutorial .

Get Rift for Adobe After Effects: https://aescripts.com/rift/

Music: Otis McDonald.

Want to ask something? Contact us!

Tutorial: Fill-Mix-Flush using Newton3

Here’s a new tutorial for Newton3, the physics engine for Adobe After Effects!

In this classic case of animation which uses physics intensely, you’ll learn how to fill a shape, turn it to a washing machine then drain it.
Import animated objects into Newton3.
Add and remove objects from your simulation.
Fine tweak your simulation to get the best result!
We’ll also show you how to use our tool Solidity to colorize hundreds of objects easily!

Get Newton3 and Solidity (part of the set “LayerGenerator”) !

Want to ask something? Contact us!

Interview(s)!

Our friends from Motion Café invited us on their show to talk about our history, our products and do some demos. Finally, we had so much to say that we did 2 shows!
In the first we talked a lot about our history and Newton. Valentin was able to come back to the genesis of this product, show a little moment of history with the first video made with it and also the first version of our tool. We also have show more technical things as well as tips.

(Video is in french but you can use the subtitles option to translate it)

In the second show, we came back to Newton and in particular to the (new) skater’s setup. We then talked about Pastiche and LayerGenerator with new features, and we ended with a little tour of ConnectLayersPRO!

You can find these videos on the Motion Café Youtube channel.

2019 Summer Of Code

Our 2019 holiday homework has consisted of recreating some great Processing animations in Adobe After Effects.

The original Processing sketches have been written by Dave Whyte (github) and Owen McAteer (github). A big thanks to these talented artists and developers to make their source code available.

Most of the animations are looping animations that use only one shape layer (driven by expressions).

You can freely download each project! (CC 2019 and above).

3D Options

This After Effects script displays a palette that allows you to quickly modify the Geometry and Material options of the selected layers. If you want the panel to be dockable, place it into ScriptUI Panels folder.

USAGE:

  • Select some 3D layers.
  • Execute the script and modify parameters.
Icon

3D Options

Download