Set Keyframe Influence

What type of scripts do you need?

Moderator: byronnash

Post Reply
Posts: 14
Joined: August 9th, 2012, 11:29 am

I'm attempting to make a toolbar that lets me change the incoming or outgoing velocities for all selected keyframes to set amounts (60%, 80%, 100% etc) with a single button press so I don't have to keep right clicking and going into the keyframe velocity window every time. The two problems i'm running into are:

1. How to loop through the currently selected keyframes on all currently active layers, and change just their influence (easing).
2. How to accommodate different types of properties, so it can change Position/Rotation/Scale keyframes simultaneously. Doing it manually through the keyframe velocity window only changes one property type at a time, and i'd love to have it be a single button press.

I spend a huge chunk of my day setting keyframes incoming influence to higher percentages. Id love to have a single button that does that. If anyone can help me get on the right track I would be most grateful.

Here's the docking panel I have for it so far, but doesn't work quite right yet.

EDIT: Getting closer by using what I learned from Paul Tuersley's delete duplicate keyframes script, but it edits more than the keyframes I have selected, and I want it to treat the speed as AE would if you were to "easy ease in" something and then set just the influence, instead of forcing the speed.

Code: Select all

function EaseToolBar(thisObj) {
          function EaseToolBar_buildUI(thisObj) {
                    var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Ease Tool Bar", undefined, {resizeable:true});
 res="group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
                              myStaticText: StaticText{text:'Outgoing Velocities'},\
                              myGroup: Group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
                                        myGroupItem1: Button{text:'< 33%'},\
                                        myGroupItem2: Button{text:'< 40%'},\
                                        myGroupItem3: Button{text:'< 60%'},\
                                        myGroupItem4: Button{text:'< 80%'},\
                                        myGroupItem5: Button{text:'< 100%'},\
                               myStaticText2: StaticText{text:'Incoming Velocities'},\
                              myGroup2: Group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
                                        myGroup2Item6: Button{text:'100% >'},\
                                        myGroup2Item7: Button{text:'80% >'},\
                                        myGroup2Item8: Button{text:'60% >'},\
                                        myGroup2Item9: Button{text:'40% >'},\
                                        myGroup2Item10: Button{text:'33% >'},\
                    //Add resource string to panel
                    myPanel.grp = myPanel.add(res);
 myPanel.grp.myGroup.myGroupItem1.onClick = function(){

var activeItem = app.project.activeItem;

if (activeItem != null && activeItem instanceof CompItem) {
   var selectedProps = activeItem.selectedProperties;
   var y;
   app.beginUndoGroup("KeyFrame Easing");
   for (var x = 0; x < selectedProps.length; x++) {

      if (selectedProps[x].numKeys > 1) {      
         y = 1;
         while (y < selectedProps[x].numKeys) {
             var easeIn = new KeyframeEase(0.5, 50);
             var easeOut = new KeyframeEase(0.75, 85);
             var myProperty = selectedProps[x];
             myProperty.setTemporalEaseAtKey(y, [easeIn], [easeOut]);
             y ++;           

                    //Setup panel sizing and make panel resizable
                    //myPanel.grp.minimumSize = myPanel.grp.size;
                    //myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}
                    return myPanel;
          var EaseToolBarPal = EaseToolBar_buildUI(thisObj);
          if ((EaseToolBarPal != null) && (EaseToolBarPal instanceof Window)) {

Posts: 1
Joined: May 16th, 2023, 12:34 am

Hello! I hope you're able to see this and I wonder if you ever got this to work? I have been thinking about this exact thing for years as I am constantly setting keyframe velocity for individual keyframes all the time and I hate all the right clicking and typing and ideally I'd like to get a streamdeck setup where I can click a keyframe and hit a button to set the keyframe ease/velocity automatically. So now I am finally trying to figure it out for myself as no one else seems to have figured it out, or at least put it somewhere online for others to see.

I have very low understanding of AE scripting, but I was able to get something to sort of work, I can select keyframes of the main properties like opacity, rotation, position and change their temporal easing based on this script. It's pretty simple compared to yours, but I'm assuming you were trying to figure out how to get it to apply to any keyframe that is selected no matter if it needs an array with 1 or more elements (3d for example), part of the ADBE Transform Properties, or property within a property (a slider in a slider control effect for example). That is something I haven't been able to figure out how to automate. But maybe you or someone else could shed some light on that?

With this I can select a single keyframe, run this script, and it will adjust the Keyframe Velocity as such. Would love if someone could shed some light as to how to make this able to apply to keyframes on any effect automatically.

Code: Select all

var easeIn = new KeyframeEase(0.5, 50);
var easeOut = new KeyframeEase(0.75, 85);

var keyIndex = app.project.activeItem.selectedLayers[0].selectedProperties[0].selectedKeys;
app.project.activeItem.selectedLayers[0].selectedProperties[0].setTemporalEaseAtKey(Number(keyIndex),[easeIn], [easeOut])
Post Reply