Origin Story
I was mere points away from the Magna Cum Laude distinction, and it slipped away, forever. The culprit was that blasted Python course I took my final semester at Duke. Now, 5 years later, I recognize that course as what it truly was: a godsend.
That course taught me foundational computer programming principles, which have enabled me to independently teach myself how to utilize After Effects Expressions and Scripting -- both of which are JavaScript-based.
I also owe a great deal of my knowledge to the great Dan Ebberts, who, in the motion graphic world, needs no introduction. Without his great tutorials and swift responses to emails from strangers, I wouldn't know a 10th of what I know today.
With all that said, what kind of things can I do? Check out some examples:
Using Scripts to Create Comps Based on a Template
While working on my most-recent kinetic-type project, I developed a time-saving script. Rather than create however many Compositions I would need, each with its own Text Layer and Solid Layer, I created a script that referenced a string, the various breaks I called attention to within the string, and a Template Composition. From these raw elements, the script created a new folder within my Project, comprised of nicely-organized Comps featuring the text found within the original string. This script has basically given me the power to create 100+ unique Comps in seconds.
The following two videos are example of how quickly I can create what I need:
Quickly Flip Through Layers of Images
I created a JavaScript expression that enables me to quickly flip through a list of Image layers. It works with the Opacity property. All I do is define the 1st layer of the list, the last layer of the list, and an array of times. The time array defines how quickly AE should flip from one image to the next.
Here's the code:
function flipQuick(startLayer, endLayer, myTimeArray) { myTimeArray = myTimeArray.split(","); end = 0; j = 0; while (time >= end) { start = end; end += parseFloat(myTimeArray[j % myTimeArray.length]); j ++; } numberofLayers = Math.abs(startLayer.index - endLayer.index); if ((j % (numberofLayers + 1)) == (index - startLayer.index)) { return 100; } else { return 0; } } flipQuick(thisComp.layer("Comp 4"), thisComp.layer("Comp 1"), ".5,.4,.3,.25,.21,.2")
Here's an example of the effect:
#JavaScript
There are a few things going on in this video:
a) I created a custom Text Effect function/preset that enables me to transform a string into another string. It does this by first displaying the initial string, then transforming each character in that string to a character of my choosing, and then transforming those characters into the final string.
b) I created code that identifies marker placement on a timeline and uses that timing information to trigger effects. This was particularly helpful in timing animations to the beat. With this code, all I had to do was cue up a song, hit the right marker-producing keys on my computer, and the code produced cool animated effects timed to the markers.
Twiggy
This video features a number of effects, most notable of all is the code that references marker times to produce animated effects.
Creating a Custom Marquee Effect
This video features my custom Marquee text effect. It takes a string and spins the word around as many times as desired, at a rate of my choosing.
Scrambling an Image
1) In this example, I created an effect that scrambles an image. The gist of how I did this was by creating a For Loop that produced an array of 16 Position property values -- one per each image section. I then shuffled the array over time.
2) After creating the animation above, I decided I didn't want the sections of the image to just change position instantaneously; I wanted them to move, with an ease, from one position to another. I achieved this with the aid of a While Loop and the built in AE Ease function.
3) Upon achieving that, I realized I didn't want the image moving diagonally, but only horizontally or vertically. In order to achieve this, I created a custom ease function based on the AE Ease function. To be brief, it gets a start position and an end position and transforms the path to the end position into two paths: a vertical and a horizontal one. A person can define if he/she wants the object to move vertically or horizontally first.
Here is that function:
function tomiEase(val, start, end, startVal, endVal, vh) { if (vh == "v") { midPoint = [startVal[0], endVal[1]]; } if (vh == "h") { midPoint = [endVal[0], startVal[1]]; } halfval = ((end - start) / 2) + start; movement = startVal; if (time < start) { movement = startVal; } if (time >= start && time < halfval) { movement = ease(time, start, halfval, startVal, midPoint); } if (time >= halfval) { movement = ease(time, halfval, end, midPoint, endVal); } return movement; } tomiEase(transform.position, position.key(1).time, position.key(2).time, position.key(1).value, position.key(2).value, "v")