Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Accumulative Values

  • Accumulative Values

    Posted by Jamie Bradshaw on May 27, 2009 at 3:52 pm

    Hi all.

    I might struggle to explain this problem as I think I have fried my brain trying to work it out, so bear with me.

    I’ve created an expression that looks at a specific layer’s markers and calculates the time and index of the previous and next marker. That part works fine, so I have the following variables:

    prevMarkerIndex
    prevMarkerTime
    nextMarkerIndex
    nextMarkerTime

    I then want to add to the expression so that with each marker a value will accumulate by a certain value (determined by a Slider which I will keyframe over time). I can’t find a way of doing it without it becoming self-referential.

    For example, if my accumulative Slider is set to 10, then with each marker the value will increase by 10, but I need it so that over time I can keyframe the accumulative Slider. Let’s say to 2, so that the result is something like this…

    ** accumulative Slider = 10
    @ Marker_01, value = 10
    @ Marker_02, value = 20
    @ Marker_03, value = 30
    @ Marker_04, value = 40
    ** accumulative Slider = 2
    @ Marker_05, value = 42
    @ Marker_06, value = 44

    I hope this makes sense? Any help would be MASSIVELY appreciated.

    Thanks,
    Jamie

    JimJam•Graphics
    https://www.jimjamgraphics.com/

    Jamie Bradshaw replied 17 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 27, 2009 at 4:06 pm

    It’s hard to know exactly what you’re trying to do, but it’s probably going to look something like this:

    accum = 0;

    if (prevMarkerIndex > 0){

    for (i = 1; i <= prevMarkerIndex; i++){ accum += accumulativeSlider.valueAtTime(marker.key(i).time); } accum }else{ ???? } I'm not sure why you'd need the next marker though. Dab

  • Jamie Bradshaw

    May 27, 2009 at 4:34 pm

    Once again Dan you come up with the goods! Massive thanks! It seems pretty obvious now, hehe.

    I’ve managed to adapt that into my stuff and it works fine. Just so you know, the next marker stuff is for some other things (like doing an easeOut from the prev marker to the next).

    Thanks again Dan, really appreciated your help

    JimJam•Graphics
    https://www.jimjamgraphics.com/

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