Skip navigation

Category Archives: After Effects

This is the code needed to draw the “Beam” effect between two objects that are in After Effects 3D space:

Add “Beam” to a solid (not a Null!).

Add this expression on the Beam “Starting Point” property (replace text in “quotes” with your layer names, of course):

L = thisComp.layer("name_of_another_layer_in_the_timeline");
 fromComp(L.toComp(L.anchorPoint));

 

Add this expression on the Beam “Ending Point” property:

L = thisComp.layer("name_of_the_target_layer_in_the_timeline");
 fromComp(L.toComp(L.anchorPoint));

Here’s a link to more usage of the Beam effect between dynamic objects in only 2D.

While there may be other issues, the biggest one that keeps catching me when trying to import Illustrator layers to After Effects is if the person creating the artwork forgot to check “save as PDF compatible file” when they saved it.  Without that check, the preview won’t show in Finder, and the file coming into After Effects will be in one flat layer.

There’s a ridiculous bug in After Effects 2014.2.  (or maybe the OS I’m using?  10.10.3 Yosemite)

Problem:
When I Collect Files, during the process if I move my mouse/input device the Collection will fail, leaving a partial “Footage” folder, and no AE file. 
Solution:
If I use the Return key to start it and DON’T TOUCH MY MOUSE it works!

Additional bug:
When Collecting, the “Reduce Project” check-box option doesn’t seem to work in any case. However, it seems to work correctly when used outside of the Collect Files process.

Speechless.

Discovered the solution here:  https://forums.adobe.com/thread/1396174

on the second hand’s rotation, add the expression:
Math.floor(time)*6

or if you want it to start at a particular rotation, use:
transform.rotation+Math.floor(time)*6+Math.floor(time)*6

Thank you Dan Ebberts.

I’m in the middle of a project where the client said, “Let’s make the ones farther in the distance fade in opacity.”  Hmmm. I have 384 objects in my Comp!  Expressions to the rescue!  Paste this code into the existing Opacity of each layer that needs to be controlled.

//Use Z position range to control opacity
fullOnZ = -900; //z value where you want opacity to be 100%;
fullOffZ = 2700; //z value where you want opacity to be 0%;

num = 100-(100*(transform.position[2]+(fullOnZ*-1))/fullOffZ);

//this step allows you to keep existing opacity keyframes
//by adding our formula result to the existing opacity
num = num * (transform.opacity/100);

// done!
value = num;



I’ve run into a bug exporting (radial) gradients from Illustrator, where the left color of the gradient always turns white on export. Until they fix it, here’s my workaround:

1. Make one layer for export visible.

2. Save as .eps

3. Check “use artboards” AND Range: 1.  (If I don’t specify the range, the file dimensions are shrunk to the bounding size of the artwork. This is bad news if you need to go back and adjust any artwork because changes can affect the centerpoint of the art, which mis-aligns it in After Effects.)

4. Repeat for next layer.  Note that each saved file will be tagged with “…-01”. This is reference to the Artboard number.

I can also set my art up on individual artboards and save only once, specifying the full range of artboards. This is often more trouble than it’s worth unless I’ve got a lot of layers to do and I don’t mind them being uniquely named only by their Artboard number.

(Affects After Effects CC and Illustrator CS6 and CC, if not other versions)

Update:
Laurence Yates has a more thorough walk-through, and mine below seems to be broken now in AE 2014.2 Check his tutorial out:
http://www.notbyhalf.com/adding-commas-animated-numbers/

Or just use this code:
// Pick-whip number from Slider or Point Control and assign to mySlider
// For example: var mySlider = effect("Point Control")("Point")[0];

var mySlider = 123456789;

// Use the commas function defined below to format your number.
// Commas takes three properties - the number input,
// the size of the groups of numbers and the number of decimal places.
// You can use this function and only give it the base number.

var numberstring = commas(mySlider);

// This is the final output of this expression.
// Use quotes around other text that you want to
// join with your numberstring variable.
// eg. '$' + numberstring + ' RAISED'

'$' + numberstring;

function commas(number, groupSize, decimals){

// Default settings if only a number is provided.

groupSize = (groupSize == undefined) ? 3 : groupSize;
decimals = (decimals == undefined) ? 0 : decimals;
var theComma = ",";

// Round to given decimal places and convert number to string
var strNumber = Number(number).toFixed(decimals).toString()

// Store decimal places separately,
//with a bullet point if they exist or empty string if not.
var arrNumber = strNumber.split('.')
var decimalPlaces = (arrNumber.length > 1) ? '.' + arrNumber[1] : '';

// Convert to array to split into characters
var anum = arrNumber[0].split('');

// New array to hold formatted number
var fnum = new Array();

var count = 0;

// Process the characters in reverse,
//inserting a comma after each groupSize.
for(var i = anum.length-1; i >= 0; i--){
fnum.push(anum[i]);
count++;
// If the count is divisble by the groupSize and this is not
//the last (ie. first) character, add a comma.
if(count % groupSize == 0 && i != 0){
fnum.push(theComma);
}
}

return fnum.reverse().join('') + decimalPlaces;
}

//——————older post———————–//

This is a quick expression to add a “$” and a comma at the thousands place (only).  Put this script on the “source text” attribute of a text area. Add the effect: Effects>Expression Controls>Slider Control and put a slider on the text area to keyframe the value.

 

v="$"+Math.round(effect("Value")("Slider").value);
if (v.length > 3){
v.substr(0, v.length -3) + "," + v.substr(-3);
}else{
v
}

This will display the markers as text on screen.

Apply this code to the SourceText expression area of a Text layer. Also note that the code below is referring to markers placed on a Null layer called “markers”. (Doesn’t work with markers put in the top of the timeline).

n = 0;
if (thisComp.layer("markers").marker.numKeys > 0){
  n = thisComp.layer("markers").marker.nearestKey(time).index;
  if (thisComp.layer("markers").marker.key(n).time > time){
    n--;
  }
}

if (n == 0){
 "";
}else{
text.sourceText=thisComp.layer("markers").marker.key(n).comment;
}

What a goofy pain. Every time I use loopOut to make a looping sequence (running, flapping, etc.) I end up with a blank frame at the end of each loop sequence.

My solution was to not change any of the (2 automatically created) keyframes in my outer comp (the one applying Time Remap), but to

1. Inside my precomp, add an additional frame to my precomp that matched the first frame of the looping sequence and extend the footage one frame so that it’s visible on that last keyframe.

As usual,
2. Apply Time Remap to the outside of my comp and the Expression for loopOut.
3. Extend the duration, now that it can be expanded to infinity.

Honestly, I still don’t understand why that would affect the frame that was “blank”, but hey, I’ve got a deadline to meet! I’ll sharpen my axe later!