Archive for the ‘AfterEffects Expressions’ Category

Amended AE Expression – to work between two markers

Wednesday, July 20th, 2011

Countdown text initially reads 100 but once playhead reaches first marker (“1″) count down begins counting back from 100 to 0
Countdown text will reach 0 when the playhead reaches the second marker (“2″) and will stay at 0 thereafter

or to put it in a more simplistic way – it does exactly what the client wants.

var tTF = timeToFrames();
var frDuration = thisComp.frameDuration;
var endTime = thisComp.marker.key("2").time;
var stTime = thisComp.marker.key("1").time;
var currentTime = tTF*frDuration;
var totalTime = endTime - stTime;

var content = 100-(((currentTime-stTime)/totalTime)*100);

if (currentTime > stTime)
{

if (content > 0)
content
else
0
}
else
100

little note for later gotchas – can’t use the variable name ‘startTime’ as it appears to be reserved – it kept giving me the number 6 though i am not sure why

My Fyrst AfterEffects Expression

Wednesday, July 20th, 2011

So like the fool that I am I agreed to add some content to a friends video that he is creating for a book launch.

Initially I had planned to use Flash to create the video but then there were issues – I couldn’t get the video as an flv to start with – then Pete told me that the video would need to be distributed via youTube and the usual channels – so I started doubting that the creation of an swf file would be the best approach.

But I still needed to create a timer.

I blagged a bit of knowledge from Ivan Pinto Bravo who told me that I needed to use something called Expressions in AfterEffects and showed me the basics of getting time info from a movie clip.

So here it is – it probably isn’t the best bit of Java ever but to say that it does the job intended makes me happy and proud

100-(((timeToFrames()*(thisComp.frameDuration))/(thisComp.marker.key("1").time))*100)

But there’s more!

I don’t want the display to start showing negative values so I experimented with a bit of variable adding and guess what! it worked


var tTF = timeToFrames();
var frDuration = thisComp.frameDuration;
var markerTime = thisComp.marker.key("1").time;
var content = 100-(((tTF*frDuration)/markerTime)*100);

if (content > 0)
content
else
0