After Effects best practices
After Effects templates for custom projects have no special requirements and you can simply create your template as you would create any video. However, we recommend following a few best practices to help you get the best output and have an easier time working with Plainly. These practices involve formatting text and images, using a clear naming structure, and similar adjustments.
Naming layers
Custom projects often have many layers. To be as efficient as possible during the setup, add a prefix in front of the layer name when naming layers that are planned to be dynamic. This way you can easily identify them in Plainly during parametrization.
Another benefit of having a prefix in front of the layer name is for the use of Auto generate templates in Plainly. If you have a prefix in front of the layer name, and you choose the prefix option in the automatic parametrization, you can then provide the prefix, and all layers with that prefix will be automatically parametrized. This is a great way to save time and effort when working with large projects.
Compositions
When creating compositions, we suggest adding a prefix to a rendering composition, for example render_. This way you can easily identify the composition that is used for rendering in Plainly. By prefixing the name of the rendering composition, you can also use it in the automatic parametrization.
Make sure that you don’t add any non-English characters to layer/file names. This will cause failed renders.
Scaling
Scaling ensures your text, images, and videos always look well-positioned and visually consistent across varying input sizes or dimensions. Whether you’re working with dynamic text or media assets, applying auto-scaling methods can help maintain layout integrity without manual adjustment. Below are methods for scaling both text and media elements effectively in After Effects.
Text scaling
We also support the auto-scaling of text through the Text auto scale, that will do the auto-scaling automatically for you.
Depending on the type of text you are using in the template (paragraph or point) you can add the following expressions to achieve auto-scaling. When added, the text will automatically scale based on the input and a defined bounding box.
Paragraph text
If your templates use long text, you are probably using paragraph text (bounded by an area), and it probably goes into multiple lines. Create an area that the text should fill, and define a reasonable number of characters that will cover all use cases. If you know all of the use cases, that’s the best-case scenario because you can plan and design accordingly.
The best way to keep this controlled is to limit the number of characters that the user inputs. This is not enforced in After Effects, so provide the maximum number of characters each layer can take and notify the user.
In order to keep the text centered at all points, apply the following expression to the anchor point of that text layer.
top = sourceRectAtTime().top;
left = sourceRectAtTime().left;
x = left + sourceRectAtTime().width / 2;
y = top + sourceRectAtTime().height / 2;
[x, y];Point text
If your text is on one line, you’re probably using point text. Point text is easy to manage because you can add a simple expression that will automatically scale the size of the text based on the input. Create a solid layer named “boundingbox”, which will serve as the borders for your text.
If the text goes beyond the borders of this layer, it will start scaling down. After you create the solid layer, add the following expression to the scale property of your text layer.
text_width = thisLayer.sourceRectAtTime(time).width;
text_height = thisLayer.sourceRectAtTime(time).height;
rect_height = (thisComp.layer("boundingbox").height * thisComp.layer("boundingbox").scale[1]) / 100 - 2;
rect_width = (thisComp.layer("boundingbox").width * thisComp.layer("boundingbox").scale[0]) / 100 - 2;
sTemp = Math.min((rect_width / text_width) * 100, (rect_height / text_height) * 100);
s = Math.min(100, sTemp);
[s, s];
If you have multiple text layers in the same comp that need automatic scaling, make sure to create multiple bounding boxes, and change their names in the expression above.
Text background
If your paragraph text has a colored background, and you want the background to scale with text, make sure to apply the following expressions:
yPos = thisLayer.sourceRectAtTime(time).height / 2;
[0, yPos];subText = thisComp.layer("name_of_our_text_layer");
textWidth = subText.sourceRectAtTime(time).width + 70;
textHeight = subText.sourceRectAtTime(time).height + 70;
[textWidth, textHeight];Image / video scaling
We also support the auto-scaling of images through the Media auto scale, that will do the auto-scaling automatically for you.
One of the biggest issues when creating templates is scaling images and videos. In a perfect world, all images/videos are the same dimensions, but this usually is not the case. Luckily you can get auto-scaling assets in After Effects.
To begin, each dynamic image or video should reside within its own composition. Think of these compositions as containers that hold the respective media. It’s essential not to apply any effects or keyframes directly to the image or video within these compositions; instead, all adjustments should be made to the composition itself.
The dimensions of these “container” compositions should reflect the maximum size you want the image or video to appear within your project.
We need to add the Scale to Comp effect on each image/video. This effect will automatically scale the image/video according to its container comp.
- Download the preset from this link
- Paste the preset inside the Documents > Adobe > After Effects (version) > User Presets folder
- Apply the effect to every dynamic image/video
When you apply it, you will have a couple of options in your Effect Controls panel, make sure to check the first box, and apply an expression to the second checkbox:
img = thisLayer;
imgHeight = img.width;
imgWidth = img.height;
if (imgWidth > 2 * imgHeight) {
100;
} else if (imgWidth <= imgHeight) {
100;
} else {
0;
}img = thisLayer;
imgWidth = img.width;
imgHeight = img.height;
if (imgWidth > 2 * imgHeight) {
100;
} else if (imgWidth <= imgHeight) {
100;
} else {
0;
}
Color control
If you want to dynamically swap a color of a solid layer, we support that out of the box. Just upload your project, make your solid dynamic, and you will be able to control its colors.
If you want to dynamically swap out colors of other layers (such as shape, text, or similar) you will have to set up a color-control layer. This is a text layer in After Effects that will hold the HEX value of the color.
Start by adding a new text layer, and type in the hex code of the color (without the #). Then, go to the layer which you will re-color and add the following expression to its color property:
function hexToColor(theHex) {
var r = theHex >> 16;
var g = (theHex & 0x00ff00) >> 8;
var b = theHex & 0xff;
return [r / 255, g / 255, b / 255, 1];
}
hexToColor("0x" + comp("control_comp").layer("color_primary").text.sourceText);Make sure that you reference the right comp and the right layer! You can have as many dynamic colors as you wish, just make sure to create a text layer for each color.
If the layer you want to re-color doesn’t have a color property, you can add a fill effect and then apply the expression to the color property of that fill effect.
Project optimization
When creating templates, make sure that your project is as optimized as possible. Avoid using heavy effects and try to keep the number of layers to a minimum.
Pre-rendering
Pre-rendering is the most useful technique for lowering render times. Pre-render all layers that are using effects or slowing down the preview in After Effects. Pre-rendering image sequences also helps you stay under the upload limit. Isolate the layers you want to pre-render one by one and render them out as an MP4. If you have layers with transparency, add a green screen as a background and key it out in the template.
For example, if you use any Trapcode plugins, pre-compose them, render that composition as an MP4 sequence, and turn off the original layer. This significantly boosts render times because After Effects doesn’t have to calculate heavy layers with complex effects or plugins—it just plays an MP4 video.
Effects and plugins
Effects heavily impact render times. If speed is important to you, reduce the number of effects or plugins to a minimum, or avoid them entirely when possible.
Expressions
Expressions can also hurt render times, especially complex ones. After Effects needs to calculate the expression you set every frame, and large expressions can slow down your renders considerably.
Assets
Large assets also affect render time. Crop assets in your composition to the right dimensions instead of using a 4K image or video in a 720p composition.
Also, to reduce project size, check if there are any unused files in your project. Go to File > Dependencies > Reduce project. This will remove all unused files and folders from the project.
Resolution
If you are posting to social media, there is no need to use 2K or 4K videos. Research the best dimensions for each platform and cut down the resolution if your videos are too large.
Pre-comps
Before finalizing your project, check all pre-comps to make sure that you don’t have unnecessary files in there. It’s easy to overlook objects off-screen, which will increase your render times. Check everything, clean up, and optimize.
Use .wav for audio
After Effects often has issues with .mp3 audio files. If you are using audio in your project, we recommend using .wav files. This will ensure that your audio is rendered correctly and that there are no issues with the audio quality.
Convert Illustrator/Photoshop files
It’s always a good idea to convert any Illustrator / Photoshop files into .png and .jpg.