Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Count up Expression

  • Count up Expression

    Posted by Benmcewan on July 22, 2007 at 11:23 am

    Ok well I want an expression that will count from 0 – 60 between
    0:03:00:22 and 0:03:06:00 (I’m running in 25 frames per second); or just between 2 keyframes if you can do it that way

    Sam Moulton replied 18 years, 9 months ago 6 Members · 7 Replies
  • 7 Replies
  • Mike Clasby

    July 22, 2007 at 5:43 pm

    Dan’s Universal Up/Down Clock should do the trick:

    https://www.motionscript.com/design-guide/up-down-clock.html

  • Benmcewan

    July 23, 2007 at 6:22 am

    I don’t want it in a time format though, I want it just to count from 0 – 60 between two keyframes

  • Lord Scales

    July 23, 2007 at 6:44 pm

    This should help more… https://www.motionscript.com/design-guide/counter.html

    In a simplified way:

    startTime = 1.5; //in seconds
    endTime = 5; //in seconds
    startValue = 0;
    endValue = 60;

    linear (time, startTime, endTime, startValue, endValue)

    Apply it in a text layer, in the property Source Text.

    I am not with AE here, so I did not tested it, but I think it works.

  • Dan Ebberts

    July 23, 2007 at 7:12 pm

    Just one note – be careful using “startTime” as a variable name because there is already a layer attribute with that name. I found this out the hard way. 🙂

    Dan

  • Darby Edelen

    July 24, 2007 at 1:36 am

    [Lord Scales] “startTime = 1.5; //in seconds
    endTime = 5; //in seconds
    startValue = 0;
    endValue = 60;

    linear (time, startTime, endTime, startValue, endValue)”

    You can also modify this to use keyframe times automatically.


    key(1).time

    Should give you the time in seconds where the first keyframe of the property is, key(2).time will give you the second.

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

  • Darby Edelen

    July 24, 2007 at 1:40 am

    Just an addendum to that, key(1).time will give you an error if you don’t have any keyframes for that property. You should be able to try() and catch() these errors in the expression though:

    https://www.w3schools.com/js/js_try_catch.asp

    (AE uses JavaScript with custom classes/methods/variables for its expressions)

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

  • Sam Moulton

    July 28, 2007 at 12:47 am

    for something this simple I’d just use an expression slider and pick whip to it, then animate the slider by setting 2 keyframes. Use math round or math floor to get rid of the decimals.

    Math.floor(effect(“Slider Control”)(“Slider”))

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