const keyTimes = [1, 2, 3, 4, 5],
keyValues = [30, 10, 5, 25, 15];
const arr = keyTimes.filter((v, i) => keyValues[i] >= 20 );
Array.prototype.filter doesnt exist there, and function expressions as in the filter argument are not recognized.
You need rewrite it "the old way".
Thank you Xavier,
I've came up with this solution:
var keyValues = [30, 10, 5, 25, 15],
keyTimes = [1, 2, 3, 4, 5];
for (var i = keyTimes.length -1; i >= 0; i--)
And I'm getting keyTimes = (1,4);
But, as you know the time in AE is not in frames but in seconds, so in real life my keyTimes are like this: 0.3213213, 0.45689789, 1.456546456, 2.456456456 etc. And with these values I don't get the right result. What could be a problem? I'm getting those values from 'Convert Audio to Keyframes', so I have value every keyframe. Thanks for your help...
I dont know, it looks unrelated.
In which sense you "don't get the right result" ?
I've made a mistake. It should be keyTimes[i] instead of keyTimes[i-1]. Thank you for your time Xavier. Appreciate that.