Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Snapping all keysframes to a full frame

Community Beginner ,
Jan 24, 2024 Jan 24, 2024

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 

TOPICS
How to , User interface or workspaces
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 24, 2024 Jan 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();
}

 

 

screenshot.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 24, 2024 Jan 24, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 25, 2024 Jan 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 16, 2024 Nov 16, 2024

Hey, I agree with Rick, snapping keyframes to the nearest frame is usually not needed. However, if you have a bunch of keyframes and some are set to linear and some to hold, and the hold ones are not snapped to the frame, you might get weird results if motion motion blur in on. That's a pretty specific case but i now have to move around 50 keyframe manually, it would be usefull to have a native ae command to do it:)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2025 Jun 17, 2025
LATEST

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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines