[Johan Bakke] “Is there any way I can select all photos and make them sync to the keyframes or do I have to do this manually?”
Put all your photos in a precomp (let’s call it PHOTOS), set the duration of each photo to be one single frame, then use the Sequence Layers Keyframe Assistant [link] to put them all back-to-back with no overlap.
In your main comp, select your PHOTOS precomp layer and enable Time Remapping. (Either go to the Layer menu, select Time, then select Time Remapping, or press the shortcut key Ctrl+Alt+T on Windows, Cmd+Opt+T on macOS).
Alt+click the animation stopwatch for the Time Remap property and paste this expression:
// use the pickwhip to select the layer and property which holds the keyframes we should use to advance the comp
keyframeSource = thisComp.layer("Keyframe layer").effect("Slider Control")("Slider");
// find the index of the closest keyframe to the current time
keyframeIndex = keyframeSource.nearestKey(time).index;
// if the closest keyframe hasn't happened yet (in other words, we're closer to the next keyframe than the last one),
// go back one. We'll hold on the previous keyframe until the next one actually happens
if (keyframeSource.nearestKey(time).time > time){
keyframeIndex--;
}
// if we haven't hit the first keyframe yet, reset our index to the first keyframe's index
if (keyframeIndex < 1) {
keyframeIndex = 1;
};
// decrement and return the keyframe index. Keyframes are indexed from 1, but frames are indexed from 0
--keyframeIndex;
// time remapping expects time in seconds, but we've been counting frames. let's convert and return!
framesToTime(keyframeIndex);
You will need to modify one line: the one that starts with keyframeSource =
Delete the rest of that line, then use the pickwhip to select the property in your timeline that contains the keyframes. Don’t forget to add a semicolon at the end of the line.
The precomp will advance one frame for every keyframe in your linked property.
Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn]