ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using time data from an array

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Buz Bryant-Greene
Using time data from an array
on Dec 17, 2019 at 11:28:40 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
}
]


Return to posts index

Dan Ebberts
Re: Using time data from an array
on Dec 17, 2019 at 4:40:23 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



Return to posts index

Buz Bryant-Greene
Re: Using time data from an array
on Dec 19, 2019 at 8:10:38 am

Thanks - I will look into that. It's reassuring to know that's a reasonable solution.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]