Creating A Sunrise Using Expressions
Creating A Sunrise Using Expressions
| A CreativeCOW.net Adobe After Effects Tutorial |
Article Focus:
The goal of this mini-tutorial is to show you some basic targeting using expressions as well as a few other tricks. Not only can this be used to create a stylized sun but also for lasers firing or wormholes.
Download the project files here.
|
The final result of this tutorial could also be achieved using manual techniques with 3D layers and a look_at expression. "So, what's the point then ?" you may say. Apart from my technique being largely automated once it is set up, there are several other things to consider:
a) 3D layers are slower than 2D layers, both while editing and when rendering.
b) Artifacts. Even though After Effects keeps getting better in 3D, it still is a rather weak tool for that kind of compositing. Even the advanced 3D renderer is far from being really advanced (nowadays it more like deserves the title "average" or "mediocre"). It's slow, has serious motion blur and anti-aliasing problems, causes quite often crashes (because it runs out of memory) etc..
c) There is a mathematical problem - at one point our layers are likely to show unwanted flipping if they were 3D. There are ways to avoid and compensate for it, but we will spare ourselves the trouble this time around.
That's why I try to avoid 3D in After Effects whenever possible and settle for 2D solutions instead.
| Step 1: Setting up the project |
Unlike in some of my other tutorials this is really simple this time. If you like, you can even do everything in one comp but I prefer to have two compositions - the main one called Sun and one separate comp for the Beam element. Apart from that, we only need to add two layers (or Null objects) to the main composition which will control everything. I named them Center and Target and Controller. Imaginative, isn't it? You can modify Center in any way you like and use it as the disc of the sun. The other layer will remain hidden and is really only used for animation and setting parameters. To keep things simple I only added a slider expression control and called it Radius.
| Step 2: Beam me up Scotty |
The look of the Beam is really very much a matter of your personal taste. The only immediate requirement is to make the composition 1000 pixels wide. This will simplify calculations later on. You may use other values, but I suggest to always use multiples of 100 (the reason why is explained in the Grid tutorial). Keep in mind that the more beams you use, the finer they should be. Now drop it into the main composition and set its anchor point to the leftmost edge.
The Beam layer uses expressions on all three standard transformation properties. First let's take a look at the position property.
center_X=thisComp.layer("Center").position[0];
center_Y=thisComp.layer("Center").position[1];
radius=thisComp.layer("Target and Controller").effect("Radius"("Slider");
my_angle=Math.PI*2/(thisComp.numLayers-2)*(index-2)-degreesToRadians(thisComp.layer("Center").rotation);
position_X=center_X+Math.sin(my_angle)*radius;
position_Y=center_Y+Math.cos(my_angle)*radius;
[position_X,position_Y]
What are we doing here? The position of a point on a circle can be expressed as functions of sines and cosines. Unfortunately the result of those is always somewhere between -1 and 1. Therefore we must multiply the results with the Radius from our Target and Controller layer and add the values to the position values of Center. Otherwise our sun would always stay in the top left corner where After Effects' coordinate system has its origin. Furthermore we are also taking precautions and already factor in a possible rotation of Center which we need to convert from degrees to radians. The circle itself is defined as a function of Pi. To split it into equal segments, we need to divide it by the number of layers in our comp (minus the two control layers).
The rotation is calculated very much as a standard targeting function:
diffX=position[0]-thisComp.layer("Target and Controller").position[0];
diffY=position[1]-thisComp.layer("Target and Controller").position[1];
myRot=radiansToDegrees(Math.atan2(diffY,diffX))-180;
[myRot]
The last expression is also the simplest one. The scale is calculated as follows:
[length(position-thisComp.layer("Target and Controller").position)/10,100]
And that's it! Now go ahead and clone the Beam layer a few times and see the sun shine into your life ;o).

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
GenArts Sapphire 7: Must-Have VFX Plug-ins for AE & Avid
Frequent COW Contributing Editor Kevin P. McAuliffe reviews the latest version of GenArts Sapphire plug-in effects filters for both Adobe After Effects and Avid AVX versions, with ratings for current and new Sapphire users. Kevin also observes Sapphire's ability to plug into other NLEs and finishing systems, and takes a closer look at its licensing options, including purchasing, monthly rental and site licenses. You'll definitely want to see the latest and greatest of what this must-have software package has to offer.
Review, Feature
|
| | | | |
| | | |
Adobe After Effects
AE - RE:MATCH Non-matching Cameras in After Effects Play Video In this tutorial, Andrew Devis demonstrates a relatively new plug-in by RE:Vision Effects called RE:Match and how it can very quickly and accurately deal with the very common problem of non-matching cameras in After Effects.
A typical approach to dealing with say a white balance issue would be to apply Color Finesse 3 and work with that which can be a slightly convoluted process, while RE:Match deals with the whole thing in a couple of clicks!
This very powerful effect can save a great deal of time for an everyday problem and so earn its cost back very quickly as well as giving excellent and fast results.
There is another tutorial showing how this effect works in Premiere Pro as there is a slightly different way the two applications deal with reference images.
Tutorial, Video Tutorial
|
| | | | |
| | | |
Adobe After Effects
IK Character Animation: Walk to the Beat 1: Finding the Beat Play Video This tutorial is both a follow-on tutorial to Andrew's previous tutorials on IK controllers in After Effects and a helpful stand-alone tutorial showing how to define a beat range to use as a guide to animation in After Effects.
To start with Andrew shows how to use a simple expression to deal with a potential problem of controllers scaling your objects. Then Andrew shows how to find and download sample music which can be used to base your animation on. He goes on to discuss the difficulty of matching frame rates with audio sample rate and then shows how to get a reasonably close 'loop' in both After Effects and especially in Audition.
Tutorial, Video Tutorial
|
| | | | |
| | | |
Adobe After Effects
Pushing AE - And Myself
Bill O'Neil helps celebrate 20 years of Adobe After Effects with his story. Bill reveals his secret, "I learned how to use AE by making promises to my clients I didn't know I could keep."
Editorial, Feature
|
| | | | |
| | | |
Adobe After Effects
AE: Inverse Kinematic Character Animation Play Video Standard character animation in After Effects uses a process called 'Forward Kinematics' in that we animate down a linked chain - for example, upper arm linked to forearm linked to hand. To get animation we need to move the items down the chain one at a time. Inverse Kinematics creates a link back up the chain such that moving the hand would also move the forearm and the upper arm without breaking that link. This is a simpler and easier to control form of animation often used in 3D programs such as C4D and 3ds max etc. and allows us to control the animation for the complete chain through a single controller.
Tutorial, Video Tutorial
|
| | | | |
| | | |
Adobe After Effects
AE: Inverse Kinematic Character Animation PT 2 Play Video Standard character animation in After Effects uses a process called 'Forward Kinematics' in that we animate down a linked chain - for example, upper arm linked to forearm linked to hand. To get animation we need to move the items down the chain one at a time. Inverse Kinematics creates a link back up the chain such that moving the hand would also move the forearm and the upper arm without breaking that link. This is a simpler and easier way to control animation and is often used in 3D programs such as C4D and 3ds max etc. and allows us to control the animation for the complete chain through a single controller.
Tutorial, Video Tutorial
|
| | | | |
| | | |
Adobe After Effects
Advice To Editors: LEARN AE!
Kevin McAuliffe's experience has been that all editors need to know Adobe After Effects at least as well as their NLE. His own experience has been that anything less than intermediate to advanced knowledge makes it impossible to actually get anything done. Even working with the compositing power of Avid Symphony, Kevin is in AE all day, every day. Here's the story of how he got there.
Editorial, Feature
|
| | | | |
| | | |
Adobe After Effects
Prisoner To My Passion
"I don't know if it's addiction or adoration, but one way or the other, I'm hooked on her," says Creative COW's Rob Mize. "The signs are all there: the obsession with After Effects, the inability to function without After Effects there next to me on my laptop, waiting to be clicked. And the torment of each moment spent suffering any separation from my cherished compositor. Is it any wonder that I, a once innocent naïf in an analog world, now find myself enraptured by this non-linear, digital Delilah?"
Editorial, Feature, People / Interview
|
| | | | |
| | MORE |
| |
|