Set keyframe

Hi all.
Very new to automation tool kit. And while getting the general idea, im very confused re: actually making an automation.
What im trying to do is make an automation that sets keys for position/scale/rotation on selected layers
Any ideas?


Hi @frasermu , welcome to the forum!
This question is frequently asked, but the answer is only on the forum inside Aescript so it’s a good opportunity to answer this question here too.

The process of creating keyframes is quite simple, first you have to loop over the layers in the composition, then if you want to work only on the selected layers you can use the “if” automation line to filter only these layers(using the layer “selected property”), then inside the “if” line you can create the keyframes:

  1. first you have to create a property variable and select the loop name that represent the layer that you are looping on, then you can select any property from the dropdown (opacity, position x, rotation y, scale) that you want to add a keyframe to.
  2. after creating the property variable, you need to set the time property of this variable (using the “set” line), when you will add a key to this property the key will be added at this time property value so if you will set this time property to 1, the keyframe will be added at 1 second of the composition.
  3. after setting the time property, you can add a key using the “action” line, select the variable name again, and select the action “add key”, then you can type the value for this key(this line will actively create the key).

These lines will add 1 keyframe to the desired property, you can recreate part 2&3 to add more keyframes at different times or create a new variable for another property you want to work with.

In the example I created an automation that adds 2 keyframes for all the selected layers in the active composition on their opacity property.

Download -
Set Keyframes.json (7.7 KB)

Please let me know if you need a further explanation or have any question.

Hi Alon
Thank you very much for this - slowly starting to make sense
Its been a very loooong time since i did any coding so I’m really rusty :slight_smile:
The only things im not understanding is…

  1. In the “set” and “action” lines they end in 1 and 30 for custom values
  2. the script sets keys at frame 25 and frame 50

What do the 1 and 30 do? And where does it get frame 25 and 50 from?

I can alter the script to set keys on different parameters, add 1 key only etc - thats all fine.
Just trying to figure out how to alter things so it sets keys at current frame in timeline instead of a frame number generated by the script

So the “1” is the time in seconds that the key will be added at, every composition have a frame rate or fps(frames per secons),
lets say you typed 1 in the custom value of the time property inside the “set” line, if the frame-rate of your composition is 30 the key will be added at frame 30, if you will change the value to 2 the key will be added at frame 60, in any second you have 30 frames so the calculation is
“the seconds” * “the frame rate”.

in your case the key was added at frame 25 and 50 because the time was set to 1seconds and 2 seconds and the frame-rate was 25fps.

  • if you want to set the keyframe at s specific frame number that not depends on the frame rate of the composition you can do that too, you have to calculate the time,
    [your desired frame number] / [the frame rate].
    for example lets say you want to add a key at frame 5 and the frame rate is 25fps, 5/25 = 0.2, 0.2 will add you the key exactly at frame 5 of the composition.
    (keep in mind that you don’t need to know the frame rate in advance, you can get the composition frame rate automatically).

The “30” is the value of the keyframe, if you will test the automation again you will see that the opacity key at frame 25 contain the value 30%, and at frame 50 the value is 100% so the custom value inside the “action” will be the value of the key.

For adding a key at the the time indicator of the composition you first have to create an item variable and select the loop name, then the property “containing comp”, this variable will be the active composition and will open more actions and properties, one of the properties is the “time indicator”(the current time of the comp).
In the “set” line that sets the time property, you can change the value from “custom” to the new item variable name and then select the “time indicator” property, this will add the key at the current time,
for more keys you can add for the calculation “time indicator” + 1, this will add a key 1 second after the time indicator.

example 1: adding keyframes at specific frames(not seconds).
download -
Set Keyframes-Frames.json (9.4 KB)

example 2: adding a keyframe at the time indicator and 1 more keyframe after 10 frames.
download -
Set Keyframes current.json (9.4 KB)

Thanks a million - took a bit of tweaking (had to figure out that the ‘0’ was why it was snapping comp left when clicking set keyframe. Switched to "add key = pos (value) and it adds keys at current pos and current time.
Still bumbling my way through it - but slowly getting the hang of things :slight_smile:
The big driver of this is coming from toon boom - you hit F6 - you got keys for everything in one click.
AE you had to toggle everything, one parameter at a time, one layer at a time (really slow for character animation)

Well Done! this is the way to do that.

keyframes are the more complicated part of Automation Toolkit, mostly because of how Adobe handled keyframes but I am sure you will get the hang of it as you said.
Remember that you can assign a keyboard shortcut for this automation if you want that to work more like toon boom.
Good luck with your work,

HA ha - good to know i started with the hard stuff :slight_smile:
Thanks a million for your help - really cool plugin

1 Like