FORUMS: list search recent posts

Looking for best way to loop over all of the frames of a composition.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Cole Reed
Looking for best way to loop over all of the frames of a composition.
on Nov 10, 2012 at 2:35:11 am

I'm trying to create a script to export AE animation data, and I'm stuck right now trying to loop through all of the frames of a composition's layer getting and storing the time/value for a specified property of the layer.

I was thinking something like the below (note this does not work and says "timeToFrames" is undefined?)

duration = this.comp.duration;
totalFrames = Number(timeToFrames(duration));
times = new Array();
props = new Array();

for(frame = 1; frame <= totalFrames; frame++){
time = framesToTime(frame);
propVal = prop.valueAtTime(time, false);
timeValues.push([time, propVal]);
}


Any help is appreciated!


Return to posts index

Cole Reed
Re: Looking for best way to loop over all of the frames of a composition.
on Nov 10, 2012 at 4:09:12 am

UPDATE! I kept on hacking at it and got it working by using the below code. If there is a better way to go about this please let me know though. FYI, this code is in a function and prop is a layer property such as position.

var totalFrames, duration, time, frame, propVal, times, props;
duration = this.comp.duration;
frameDuration = this.comp.frameDuration;
totalFrames = duration / frameDuration
timeValues = new Array();

for(frame = 0; frame &lt;= totalFrames; frame++){
time = frame * frameDuration;
propVal = prop.valueAtTime(time, false);
timeValues.push([time, propVal]);
}

return timeValues;


Return to posts index

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