Skip to main content
Participating Frequently
January 24, 2024
Question

Snapping all keysframes to a full frame

  • January 24, 2024
  • 3 replies
  • 1275 views

So....

 

I  wasn't paying attention to a comps settings and did a whole bunch of animation in a comp thats 27.97 fps as opposed to a 24 fps. When I set it back to 24 fps the keys all end up on half key frames and its a bit of a mess. Is there anyway to select the lot and have them all pop to the nearest frame?

 

I had a quick google around and found asu_NudgeKeyFrames_selectedlayersonly.jsx

but I'm guessing it could be old as doenst seem to be working with the latest version of ae.

 

Any help would be greatfully appriciated, thanks 

3 replies

Mathias Moehl
Community Expert
Community Expert
June 17, 2025

One of my BeatEdit users just had the same question, since beat markers and keyframes generated by BeatEdit in sync with the beat have subframe accuracy and he didn't ant that for some reason.

I noticed that the script above suggested by Airweb does not preserve the keyframe easing. Therefore I created tools for my (paid) extension Automation Blocks for After Effects now, which can snap both markers and keyframes to frame boundaries (and preserve all marker details and keyframe easing):


Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Community Expert
January 25, 2024

Keyframes are always based on time. When you change the frame rate, they may not line up with the start of a frame, but the change in value will still happen at the same time, rounded to the nearest frame. Snapping a keyframe to the start of a frame will not change the animation's timing or appearance. The only thing that will change is the position of the keyframe relative to the start of the frame. Snapping every keyframe will not change the rendered movie's timing or look. In my opinion, it's a waste of time. 

 

Movies that were shot on film at 24 fps and broadcasted at 29.97 fps still look like movies instead of videos.

Participating Frequently
January 25, 2024

Thanks guys! I will check out that script.

@Rick Gerard  basically the 29.97 fps comp is a character comp nested in the main comp which is 24fps.

The character comp is showing strange glicthes when previewed within the master comp. Those glitches are not present when previewing directly in the character comp. When I nest the character comp in a 29.97 fps comp then its fine, no glitches.

Legend
January 24, 2024

Try this, you can select multiple properties at once:

 

AdjustKeyframesToComposition.jsx

 

var proj = app.project;
var thisComp = proj.activeItem;
var props = thisComp.selectedProperties;
if (!props.length) {
  alert('Please select at least 1 property.');
} else {
  app.beginUndoGroup("undo");

  for (var propIndex = 0; propIndex < props.length; propIndex++) {
    var prop = props[propIndex];
    for (var keyIndex = 1; keyIndex <= prop.numKeys; keyIndex++) {
      var v = prop.keyValue(keyIndex);
      var t = Math.floor(thisComp.frameRate * prop.keyTime(keyIndex)) / thisComp.frameRate;
      prop.removeKey(keyIndex);
      prop.setValueAtTime(t, v);
    }
  }
  app.endUndoGroup();
}