Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions The footage + frame counter based on 35mm 3 perf

  • The footage + frame counter based on 35mm 3 perf

    Posted by Jim Dodson on January 4, 2011 at 7:06 pm

    The footage + frame counter (inside the “Timecode” effect) in After Effects is based on 35mm 4 perf

    I’d like to make a counter that displays accurate feet + frames for 3 perf 35mm: which is 21.3 frames per foot.

    In order to accommodate that .3 frames there is an uneven cadence:
    So, the frame portion of the counter would go up from 0 to 20 frames then the feet counter increments by 1 as the frames counter goes back to zero. EXCEPT — after every two sequences of the frame counter going to 20 frames there is followed one sequence of the frame counter going to 21 frames so the cadence looks like this:

    0 ft 0 frames –> 0 ft. 20 frames –> 1 ft 0 frames –> 1 ft 20 frames –> 2 ft 0 frames –> 2 ft. 21 frames –> 3 ft 0 frames –> 3 ft 20 frames etc.

    Is anyone interested in making this script (or expression?)

    Ideally it would have sliders for entering “beginning footage offset” and also “beginning frames offset” numbers.

    Many thanks Expression Cows!!!

    Jim Dodson

    Jim Dodson

    8 Core Intel — Mac – OSX

    Jim Dodson replied 15 years, 4 months ago 3 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    January 4, 2011 at 8:14 pm

    I think you could use a text layer expression, something like this:


    startFeet = 0;
    startFrame = 0;

    f = timeToFrames() + startFeet*21 + startFrame + Math.floor(startFeet/3);
    ft = Math.floor(f/64)*3;
    rem = f%64;
    if (rem < 21){
    fr = rem;
    }else if (rem < 42){
    fr = rem-21;
    ft++;
    }else{
    fr = rem-42;
    ft += 2;
    }

    frs = "" + fr;
    while (frs.length < 2) frs = "0" + frs;
    fts = "" + ft;
    while (fts.length < 4) fts = "0" + fts;

    fts + "+" + frs

    You can tie the first two variables to sliders. I’d use Math.round() on them to keep them integers, like this:

    startFeet = Math.round(effect(“Start Feet”)(“Slider”));
    startFrame = Math.round(effect(“Start Frame”)(“Slider”));

    Dan

  • Jim Dodson

    January 4, 2011 at 8:28 pm

    Man, Dan — you are awesome — thank you!!

    I have three questions…

    1) When you say “text layer expression” — which effect are you suggesting? (Basic Text? Or numbers?)
    I tried numbers and I got a divide by zero error…

    2) For the rounding, should we be rounding startframe + startfeet? or fts + frs?

    3) I’m not sure where to add the mathround portion….

    I’m really lame at expressions and their usage… sorry!!

    And thanks again!

    Jim Dodson

    8 Core Intel — Mac – OSX

  • Kevin Camp

    January 4, 2011 at 8:44 pm

    [Jim Dodson] “When you say “text layer expression” — which effect are you suggesting?”

    not an effect, but grab the text tool from the tools bar an click in the comp viewer. this will create a new text layer–you might type something like ‘timecode’ if you’d like. then, in the comp layers, twirl down the properties to get to text>source text.

    select ‘source text’ and choose animation>add expression and paste dan’s code there.

    as far as the slider controls and extra rounding expressions, you can skip that and just manually enter the start feet and frames values at the top of the expression.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jim Dodson

    January 4, 2011 at 9:42 pm

    Kool! That worked…

    Just one more wrinkle:

    And it’s kinda tricky.

    Editing startfeet & startframe are fine (instead of a slider) but…

    It would be great if I could also input a “starting cadence number” where we can enter where we are in the cadence that we are beginning…

    Basically entering a: 1,2 or 3.

    So that the counter knows if it’s time to increment the frames to 21 or 20 on this cycle.

    Basically if I enter a 3 it knows on it’s very first time in counting frames it should go to 21; a 2 means the 2nd time it goes to 20 it should go to 21 and a 1 is the normal cadence…

    Jim Dodson

    8 Core Intel — Mac – OSX

  • Dan Ebberts

    January 4, 2011 at 10:03 pm

    Something like this, I think:


    startFeet = 0;
    startFrame = 0;
    cadence = 3;

    chk1 = cadence > 2 ? 22 : 21;
    chk2 = cadence > 1 ? 43 : 42;
    f = timeToFrames() + startFeet*21 + startFrame + Math.floor(startFeet/3);
    ft = Math.floor(f/64)*3;
    rem = f%64;
    if (rem < chk1){
    fr = rem;
    }else if (rem < chk2){
    fr = rem-chk1;
    ft++;
    }else{
    fr = rem-chk2;
    ft += 2;
    }

    frs = "" + fr;
    while (frs.length < 2) frs = "0" + frs;
    fts = "" + ft;
    while (fts.length < 4) fts = "0" + fts;

    fts + "+" + frs

    Dan

  • Jim Dodson

    January 4, 2011 at 10:24 pm

    ** Success !!! **

    Thanks so much Dan
    (and Kevin!)

    Jim Dodson

    8 Core Intel — Mac – OSX

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy