Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using time data from an array

  • Using time data from an array

    Posted by Buz Bryant-greene on December 17, 2019 at 11:28 am

    Beginner here, but this forum helped me immensely during the past couple of days. Thanks for the many years of discussion.

    My situation: I have an array of elements that I want to use as animation parameters. I’m comfortable accessing a specific piece of data or cycling through the whole array at a specified interval. The catch is that the data is all timestamped in a non-linear way and I only want to access “data1” and “data2” at the moment recorded in “time”.

    With if…else I can hold until “time” matches the current time. But I’m getting stuck iterating this approach. My first inclination is to increment a counter for later frames, but I’m vaguely aware that After Effects won’t hold the value. Hopefully I’m missing something obvious (think I’ve hit my learning cap for the moment) or there is a completely different approach that somebody could give me a nudge towards.

    I included a data sample in case my terminology is wrong.

    [
    {
    "time": 1.340790625,
    "data1": 0.06143156249999748,
    "data2": 0.44881889763779525
    },
    {
    "time": 1.742766718749998,
    "data1": 0.08012812499999811,
    "data2": 0.4251968503937008
    },
    {
    "time": 1.951099843749997,
    "data1": 0.10550203124999768,
    "data2": 0.4566929133858268
    }
    ]

    Buz Bryant-greene replied 6 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 17, 2019 at 4:40 pm

    You are correct about the expression not being able to hold the value, so your expression will need to loop through the “time” fields until it finds the most recent, previous value. If it’s a lot of data, you might be able to optimize it somewhat with a binary search, but that might be overkill.

    Dan

  • Buz Bryant-greene

    December 19, 2019 at 8:10 am

    Thanks – I will look into that. It’s reassuring to know that’s a reasonable solution.

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