| Adobe After Effects Tutorial |  | Joe Chao, Jiangsu, China ©2006 Joe Chao and CreativeCow.net. | Article Focus: In this tutorial CreativeCOW's Joe Chao demonstrates using expressions to create a text stream wrapping around a pillar. The pillar and its background are all completely made in AfterEffects. Now, please download the project file and get started. | A little more than a month ago, I saw a post seeking some ideas about making a kind of "text stream" in Creative Cow's AE forum. The person posting said that he tried to make it with Particle Playground, but failed because the shape of the stream was too complex. I think it seems that this task is too hard for AE's particular system. I have not found any filter of AE can create a particular system warping through a certain path. Although we can bend the particulars with a boundary wall or gravity force, or distort filters, we can not make a complex-shaped stream. Later, I found that expressions might work better in creating such a stream. After making up such an effect, I felt that maybe I could write a simple tutorial and share my experience with you. Before we get started, I want to show my gratitude to Dan Ebberts. His help was critical to my project, I couldn't have made it without him. Dan, if you are reading this tutorial, please accept my cordial thanks. The whole scene looks like this:  Because we mainly focus on expressions, I don't want to spend too much time on making up this scene. So just download the project file, open it, and go to the comp "textstream". I have prepared everything for you. My main idea is to create a "guide layer". It flies through a path, which we can adjust very easily. Then, create a Text layer, it imitates the guide layer, but it often makes some random "mistakes" in imitating. Such as: speed, size, position, in point, and so on. All these mistakes can be controlled through a null layer. Thus, every time I duplicate it, it make different mistakes. When I duplicate it for tens or even hundreds of times, I can get a stream of titles! So my job is to apply some expressions to different properties of the text layer. The expressions can make the text go after the guide layer and made some random mistakes. First of all, we have to make a "guide". Create a solid layer, set its size as 20*20. Then, I get a problem: how can I get it to fling in a helix path from the bottom of the scene and out at top? Adjusting its motion manually is not a bad idea, but in fact we can make it by developing some expressions. Before that let's observe a helix from different view angles:  In this chart, I identified some variables, and they have been marked in the charts above: Vel1: outward velocity Vel2: rotation velocity Vel3: upward velocity Radius: Radius of the helix's bottom Angletemp: angle at a certain time Radiustemp: Radius at a certain time With little trigonometry we can get the position of the guide layer at any time: X position: -Math.cos(angletemp)* radtemp Y position: -vel3*time Z position: Math.sin(angletemp)* radtemp That's it! Now we can develop the expressions of the path, add these expressions to position property of "guide": vel1=20; // outward velocity vel2=40; // rotation velocity vel3=50; // upward velocity radius=30; // Radius of the helix's bottom radtemp=radius+vel2*time; // Radius at a certain time angletemp=vel1*time; // angle at a certain time a= -Math.cos(angletemp)* radtemp; // X position b= -vel3*time; // Y position c=Math.sin(angletemp)* radtemp; // Z position [a,b,c] //output the position These expressions are based on the requirement that the bottom center of the helix is at (0,0,0), but it is not the truth. So I created a solid layer, named it "center", converted it into 3D layer. Then, adjust the last line of the expression to: [a,b,c]+thisComp.layer("center").position //output the position Now we can control the motion of the guide layer by moving the "center" layer and adjusting the variables. Adjust them until you feel satisfied with the motion path. Convert the expressions to keyframes by the menu "animation/keyframe assistant/convert expression to keyframes". Change the expressions to: loopOut(type = "cycle", numKeyframes = 0). Now, our guide layer has been able to work perfectly. It flies around the pillar again and again. That's just what we want. Since the guide layer is ready, our next step is to create the text. Create a text layer, input any text you like, that doesn't matter. (I inputted "title"). Convert it into a 3D layer. Adjust its size & font. Secondly, we are going to develop some expressions to make the titles be able to imitate the guide layer. Go to the position property of the title layer, and try adding this expression: thisComp.layer("guide").position.valueAtTime(time) It works well. Then we will have to let it make mistakes. - Random speed:
Suppose that one layer has a new speed and it takes the layer certain time (new time) to cover the distance on which the guide spends certain time (original time). Thus: timerate = new time/original time If the current time is "time", where should our title be? The position must equal to the position of "guide" at "timerate*original time". Then, the expression for position has been developed to: when=time*timerate thisComp.layer("guide").position.valueAtTime(when) Thus, as long as we set the variable "timerate" a random value, the title layer can have a random speed. So add this line for it: timerate=random(0.2,5) - Random start time
Suppose the all the titles are "latetime"'s later, and the time variable "latetime" have random values, than we can adjust the expression above into: n=index; seedRandom(n, timeless = true); //make different layers have different seed timerate=random(0.8,1.25); //add a random factor in speed latetime= random(0,10); // add a random factor in emitting the particulars when= (time-latetime)*timerate; thisComp.layer("guide").position.valueAtTime(when) //out put the position now, select the title, set its auto-rotation property to "orient along path". Try duplicating the title about 100 times. Yes, or 50~100 times. Then you will be able see such a result.  Interesting? The titles are moving along the path in random speed & order. Next we are going to add more random factors into their motions. - Random offset:
Create these expressions: xoffset=random(-20, 20); yoffset= random(-20, 20); zoffset= random(-20, 20); //these offsets can affect the thickness of the stream adjust the last line into: thisComp.layer("guide").position.valueAtTime(when)+[xoffset, yoffset, zoffset] - Random path
To let different titles have different paths, I think the expression wiggle can work in this case. But unfortunately, it seems that "wiggle. thisComp.layer("guide").position.valueAtTime(when)" can't work well. Dan advised me to appeal to "wiggle" itself. With his help, I got this expression for position property: thisComp.layer("guide").position.wiggle(amp, freq, 1, .5, when)+ [xoffset, yoffset, zoffset] - Scale
Add these expressions to Scale property: n=index; seedRandom(n, timeless = true); temp=random(min, max); [temp,temp,temp] - Etc
In the paragraph about random start time, I added some random factors into the start time of the titles. Since the guide are making a looping animation. I think the length of the guide's animation can work well as the maximal value of "latetime". So if we let expressions control the maximal value of the random "latetime" is better. Thus, we can develop this line into: looptime=thisComp.layer("guide").position.key(thisComp.layer("guide").position.numKeys).time; latetime= random(0,looptime); Thus, the data of maximal random value can get updated automatically. Similar as the "freq" in "Random path". "Freq" means "how many times every second", if we replaced it with "freq/looptime", it would become "how many times every cycle". It might make our work simple if we have to adjust the path again and again. - Text
Apply these expressions to "source text" property: n=index; seedRandom(n, timeless = true); //make different layers have different seed myText = ["After Effects", "Encore DVD", "Photoshop", "Premiere Pro", "Final Cut Pro", "Motion", "Broadcast", "Commotion", "Cinema 4D", "Particle Illusion"]; // make up a list of titles myIndex = Math.floor(random(myText.length)); //count the number of the titles in the list myText[myIndex] // random pick up a title - Control
With all expressions above, we have been able to create a stream of titles. What we need to do is just to duplicate the title layer for 50~100 times. But if you need to adjust the factor after that, you might have trouble in opening all the layers and update the variables' values. So we need something to administrate all these factors. My idea is create a Null layer and apply "expression controls" filters to control them. Let's take the max & min value of Scale property for example. Create a null layer named "control". Apply effects/expression controls/slider control to it. Rename the filter as "scalemin", change the slider range into 0~100. Duplicate this filter and rename it as "scalemax", Go to the expressions of scale property. Adjust them into: n=index; seedRandom(n, timeless = true); scalemin =thisComp.layer("control").effect("scalemin")("Slider"); scalemax =thisComp.layer("control").effect("scalemax")("Slider"); temp=random(scalemin, scalemax); [temp,temp,temp] Now, we can adjust the scale of all the titles with this slider at any time. We can also adjust all other factors in the same way. In my project file, I made a lot of sliders to take control of many other factors. - Random color
Add text animation for the title, apply these expressions to fill color property: n=index; seedRandom(n, timeless = true); r=random(0,1); g=random(0,1); b=random(0,1); [r,g,b,1] BTW, you can also add some other text animations for the titles. - Orient along path
In my case, I found an odd thing, that sometimes "orient along path" could work well. I think it might because there are some little jags along the path. Sometimes, the title, which should "orient along path", rotates like mad! So, I developed these expressions for orientation property: lookAt(position.valueAtTime(time), position.valueAtTime(time+1/25)) BTW, if your "orient along path" worked well, these expressions are not necessary. At last, after finishing all the steps above, we have only one thing to do: duplicate, duplicate, duplicate, duplicate, duplicate, duplicate, duplicate, duplicate
keep duplicating until you get enough titles. If there is anything you are unsatisfied with, just adjust the responsible sliders. Here are my results:   Nice? We at last go through so much trouble for this effect, but I think if we use these techniques for more animations, we can surely get more amazing animations. Feel free to ask questions or make comments in the After Effects forum at CreativeCOW. | If you found this page from a direct link, please visit our forums or read other articles at CreativeCOW.net |