LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

Line Chart Diagram

Line Chart Diagram
A CreativeCOW.net Adobe After Effects Tutorial


Line Chart Diagram

Mylenium
Mylenium
http://www.mylenium.de
Germany

©Creativecow.net. All rights are reserved.

Article Focus:
This tutorial by Mylenium will show you how to create a fully animatable diagram with a few expressions and some thinking around the corner. While there are other techniques to create such graphs manually based upon Masks or the Write-On effect, this one has the advantage of being quite flexible and allowing last minute changes once you have the basic template. It cannot save you from buying dedicated software if you need things such as XML import or more variations of the look, however.

In order to maintain maximum control over the look and avoid overloading one comp with too many layers, we are going to use several pre-compositions and cross-reference them with each other.

Download the Project files here


Step 1: The first comp

First off we need a master composition where we later will put everything together. I named it simply Diagram. This requires nothing special. The only thing you should add to it at this point is a Dummy layer or Null object called Controller and apply some Expression controls to it.

Go to the Effects menu and choose the Slider control from the Expression controls category. Your Effect palette will appear with a effect called Slider control. Select it, hit Return and rename it to Spacing horizontal.

Repeat this step and create sliders for Vertical Lines Thickness, Line Thickness and Point Scale.I suggest that you set the values to something other than 0 to avoid later complications with our expressions (the dreaded "Illegal division by zero"). Now choose the Color control from the Effects menu, apply it three times and rename it Line Color, Point Color and Mask Color respectively.


Step 2: Setting up the points

Next we create a composition called Diagram Points. This one holds the actual values of the diagram in the form of the points' Y position value. For reasons of flexibility I created the actual point shape in yet another sub comp called Point Marker. This way you can easily change the appearance of the points ranging from simple dots to cross hairs to complex blinking symbols.

Make sure all elements are white and have proper alpha if you want to use the Point Color from the Diagram composition's Controller layer.. In order to do so, apply the Tint effect to the layer and link its Map White to property to the respective color control in the Diagram composition. Set the Amount to Tint to 100 %. The placement of the points is in part derived from the Spacing horizontal slider in the Diagram comp using an expression as follows:

[comp("Diagram").layer("Controller").effect("Spacing horizontal")("Slider")*2*(index-1), position[1]]
This expression will calculate the X position from the slider, but use the keyframed Y position.



Notice the differently colored layer with visibility turned off? This layer is actually only needed for our calculations later on but it must be there. You can animate it just the same as the other layers, but just to be on the safe side you should change its position expression to.
[0, position[1]]
You should not forget to connect the point scale to the slider on the Controller layer in the Diagram comp. This will make it easier to balance the point size and line thickness.


Step 3: Get yourself connected

In the next step we create a composition called Diagram Lines in which we will put our lines that connect our points. This is done using a 100x100 pixels solid and some expressions. All that will be required later is to clone the Line layer to match the number of points.

The most important expressions are the position and rotation. To get proper results for those values you need to place the layer's anchor point on its left most edge and at half the height of the layer. For the position use the following expression:

comp("Diagram Points").layer(index).position 
This will place a line at each point. Since the layer does not yet know about its target point it should connect to it will be perfectly horizontal. In order to change this use
diffX=position[0]-comp("Diagram Points").layer(index+1).position[0];
diffY=position[1]-comp("Diagram Points").layer(index+1).position[1];
myRot=radiansToDegrees(Math.atan2(diffY,diffX))-180;
[myRot]
on the rotation parameter. What does this expression do? It takes the layer's position and calculates the difference to the position of the next point (which is the target point). Then those values are used to calculate the arcus tangens which is then converted into an angular value.

You will notice that, depending on your Spacing horizontal value the Line layer will not reach or overshoot the next point. All that is required to fix this, is some simple calculations on the scale parameter.

thickness=comp("Diagram").layer("Controller").effect("Line Thickness")("Slider");
diffX=position[0]-comp("Diagram Points").layer(index+1).position[0]; diffY=position[1]-comp("Diagram Points").layer(index+1).position[1];
a=Math.pow(diffX,2); b=Math.pow(diffY,2); c=Math.sqrt(a+b); [c,thickness]
This is a more complex calculation using Pythagoras' rule (yeah, it was late when I first put my mind on this project ;o) ) but you surely will prefer
thickness=comp("Diagram").layer("Controller").effect("Line Thickness")("Slider");
a=position; b=comp("Diagram Points").layer(index+1).position; c=length(a,b); [c,thickness]
In one go we also connected the Y scale of the solid to act as the line thickness. All that is now left to do is to apply the Tint effect to the layer and connect it to our Controller just as we did with our points.

Basically we now already have a usable diagram if we put our Diagram Points and Diagram Lines compositions in the main Diagram composition. It does not look very exciting, though. So once more unto the breach.


Step 4: Adding fancies

First off we want to have some sort of fill below our curve. How do we do that? Well, we could use a layer with a mask and trace our lines. Isn't that boring? It also limits our flexibility once we decide to change something. So we need a better solution. And here it comes!

Create a new composition named Diagram Mask and add a solid to it. Apply the Corner Pin effect to this layer.



The Corner Pin effect is originally intended to be used in combination with tracking data. This way you could for instance replace footage on a TV screen and match the perspective or apply a different logo to a car.

Instead of using tracking data, we will feed the position values of the four corners with data from our points. The expressions are as follows:

Upper Left:
[comp("Diagram	Points").layer(index).position[0]-2,comp("Diagram	Points").layer(index).position[1]-2]
Upper Right:
[comp("Diagram Points").layer(index+1).position[0]+2,comp("Diagram Points").layer(index+1).position[1]+2]
Lower Left:
[comp("Diagram").layer("Controller").effect("Spacing horizontal")("Slider")*2*(index-2)-1,thisComp.height]
Lower Right:
[comp("Diagram").layer("Controller").effect("Spacing horizontal")("Slider")*2*index+2,thisComp.height]
I added 2 pixels to each value so the layers would overlap once I cloned them. This avoids potential problems with the alpha because the Corner Pin effect will create antialiased edges that do not line up exactly. This is a minor drawback, but wont be noticeable since the unclean areas will be covered by the lines and points. Color the layer to your taste or once more use the Tint effect as I did.

Potential viewers like to have some reference on how they should interpret a diagram, so it's a good idea to add some rulers or grid style elements. Take a look at how I created some of those effects in the supplied project file or create your own look. It's really just a matter of cleverly combining effects or once more cloned layers that are tied to expressions.

You could come up with something like that:



or placed in 3D space something like this:



All that is now left to do is adding numbers and other text where needed and animate everything in a interesting way.

Feel free to ask questions regarding this tutorial in the After Effects forum at Creativecow.net


Please visit our forums at Creativecow.net if you found this page from a direct link.



Related Articles / Tutorials:
Adobe After Effects
Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

When most people hear the words "alpha channels", they think "transparency", but that's not exactly accurate. The truth is more complex, and a quite bit more interesting! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 3 of the best look behind the technology of compositing that you've ever seen, packed with practical advice for applying the secrets of alpha channels that's simply not possible before understanding these underlying principles. No matter which applications you're using for editing, compositing, or visual effects, this one is a must-see!

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Whether you're a full-time compositor and VFX artist, an editor working in one of the many NLEs that supports Blend Modes (including Adobe Premiere, Apple FCP and FCPX, Avid Media Composer, DaVinci Rsolve, and VEGAS Pro), or whether you just want the additional graphics power that comes with insight into the secret world of pixels, this is the tutorial for you! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 2 of the best look behind the technology of blend modes that you've ever seen, with some practical steps you can start taking today to make your work look better than ever.

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for the best look behind the technology of blend modes that you've ever seen. This isn't just for graphics and VFX, but for video editors too -- anyone who puts anything together, and wants to learn more about HOW images combine at the most basic level, in a way that applies to every application you might use, whether Adobe Premiere Pro, Apple FCPX, Avid Media Composer, DaVinci Resolve, VEGAS Pro, and yes, graphics and VFX programs like After Effects, Motion, Fusion, Nuke, Scratch, and many more.

Tutorial
Simon Ubsdell
Adobe After Effects
Disintegration VFX in Adobe After Effects

Disintegration VFX in Adobe After Effects

Join VFX guru Tobias Gleissenberger of Surfaced Studio for a classically energetic Adobe After Effects tutorial combining difference mattes, displacement maps, edge glows, and compositing tricks to dissolve (or explode!) one element in your frame while leaving the rest alone.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Common QT & Export Problems & Solutions

Adobe After Effects: Common QT & Export Problems & Solutions

Problems with Adobe After Effects? Can't import or export QuickTime videos? Exports too big? Missing codecs? AE guru and VFX whiz Tobias Gleissenberger of Surfaced Studio has the answers you're looking for to make every project come to completion more smoothly, including a comparison of exported file sizes for common codecs.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Fancy Title Animations In Adobe After Effects -- FAST!

Fancy Title Animations In Adobe After Effects -- FAST!

Follow along as VFX guru Tobias Gleissenberger shows you how how to quickly create professional-looking animated text elements using the free presets that are included with Adobe After Effects, customizing them to suit your needs. Tobias will also show you how to apply masks to your text layers to have them appear from behind other elements.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Remove People from Moving Video in After Effects with Mocha

Remove People from Moving Video in After Effects with Mocha

Learn how to remove a person from a moving video using the Remove module of the Mocha Pro plug-in for Adobe After Effects! In one of his most epic tutorial's yet, Surfaced Studio's Tobias Gleissenberger then adds a bonus Beam Up effect using some of the great filters from the Boris Continuum and Sapphire collections.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Basic Clone Effect Interaction - After Effects Tutorial

Basic Clone Effect Interaction - After Effects Tutorial

Want to take your CLONE EFFECT to the next level? Want to know how to make your clones INTERACT? Tobias Gleissenberger shows you how.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Glitch Effects Without Using Plug-ins!

Adobe After Effects: Glitch Effects Without Using Plug-ins!

Join VFX guru Tobias Gleissenberger for a fun, high-energy look at how to create all sorts of digital noise, glitch, and other disturbing video effects with any version of Adobe After Effects, without using any plug-ins!

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects Energy Ball

Adobe After Effects Energy Ball

In his latest high-energy Adobe After Effects tutorial, VFX guru Tobias Gleissenberger of Surfaced Studio combines a variety of effects to create the pulsating energy ball, composited with motion tracking, optical flares, and more.

Tutorial
Tobias Gleissenberger
MORE
© 2018 CreativeCOW.net All Rights Reserved
[TOP]