Post Production

Free Function Friday getKeysBasic

Free Function Friday getKeysBasic

getKeysBasic

Free Function Friday getKeysBasic

Welcome to episode 31 of the Free Function Friday series. This short function is handy for basic copying of property keyframes. As part of the testing code section in the tutorial, I will show you quickly how to use this function to gather all the keyframes from a property and paste them onto another matching layer property. Basic is the key word here, we will not be getting in depth about the various keyframe easing options or the hold and roving options either. They will require much more time to discuss. This will give you a starting platform to mess with in the meantime.

If you haven’t done so already there is a Free Function Friday introduction video located here that has some important information pointing to a few resources that will come in handy when scripting for After Effects.

Episode 31 getKeysBasic:

Legal note: The Adobe ExtendScript code talked about in this article and accompanying embedded video(s), and/or graphic images are not guaranteed to be compatible with every version of After Effects. David Torno, ProVideo Coalition, and Moviola will not be held liable for any misuse or incorrect use of the provided ExtendScript code. Use at your own risk.

All of the code I provide in this series, has been created and tested in After Effects CC 2014. Unless otherwise specified in the episode, the code should be compatible with After Effects CS6 through CC 2015. I’ve done my best to avoid depreciated code (code that Adobe removed at some point), and made these functions as compatible as possible. There will however be the occasional piece of code that is brand new as of a certain version of After Effects and therefore will not be backwards compatible from that version. I will mention these if that is the case.

With that said, all the code I provide in this series is open source and free to use in your scripts. I highly encourage you to expand and improve upon the code I provide and start making your own custom functions as well, but please do not repost the code I show in this series as is and claim it as your own. If you use any of the code provided in this series please give credit where credit is due. This series is meant to provide, what I feel is useful code, as well as to hopefully further explain ExtendScript and it’s quirks. While the functions we build throughout this series can perform a task all on their own, they are not meant to be a solo script. How you combine them together and expand upon them is when you will gain the most from these functions.


Was This Post Helpful:

0 votes, 0 avg. rating

Support ProVideo Coalition
Shop with Filmtools Logo

Share Our Article

David Torno is a Visual Effects professional based in Los Angeles, California. His work over the years has included commercials, feature films, music videos, and multimedia projects. During his free time, David enjoys expanding his…

8
Leave a Reply

avatar
2 Comment threads
6 Thread replies
2 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
David Torno Teague Chrystie David Torno Harry Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Harry
Guest
Harry

Hi.
I make script with your code but when using i get error: Unable to execute script at line ” keyTimes.push(prop.keyTimes(k)); ” .Function prop.keyTimes is undefined.
Help me pls!
I use AE cc2017 ver 14.0.
Thanks!

David Torno
Guest

Hi Harry, that is hard to say with out context. Right now, that error is pointing to the function argument “k” which is not defined, so you will need to check a previous line where “k” is assigned a value in your code, then check that code for a lead as to what may be causing the error. If you post a screen capture image of this area of your code, it may shed some light, but I can’t really help beyond that without seeing more of your code.

Teague Chrystie
Guest
Teague Chrystie

[double post, sorry]

Teague Chrystie
Guest
Teague Chrystie

Hi David, thanks as always for all of the wonderful content. I’m gettin’ the same thing, I’m afraid — and I’ve matched your code precisely, as far as I can tell, so I’m not sure what’s up. “Function prop.keyTimes is undefined.” (Is “keyTimes” even meant to be a function? It seems to be declared as an array.) I’ve taken a screencap of my code and thrown it up on imgur — if you’re so inclined, you can copy/paste the actual live text from the description. (The image link below, with ‘.png’ removed, takes you to the page itself.) Like I… Read more »

David Torno
Guest

There are two typos in your code. prop.keyTimes(k) should be prop.keyTime(k), and prop.keyVals(k) should be prop.keyValue(k).

It’s a bit confusing due to the variable name and attribute name being similar. You can change the variable names to be more clear by using myTimes and myValues. What you have in your code is the array being used as both the container and the function. Fast forward video to 3:45 where I explain the keyTime, and keyValue functions that are supposed to be used. Hope that helps.

Teague Chrystie
Guest
Teague Chrystie

*palm to forehead* Of course it was my mistake; this solved my problem instantly, as everyone would expect. Side-note / ‘Open Letter’: I’ve already been astonished by how helpful you’ve been over the years, generating this ongoing trove of answers and publishing them into the void for anybody to freely benefit from, like you’re Adobe Appleseed over here, but even setting aside these years of generalized educating, you made a “housecall,” just for me, IN ELEVEN MINUTES FLAT, which completely solved my problem. You’re already doing Hercules sh** for the public at large; to see the same Hercules sh** being… Read more »

David Torno
Guest

Teague, first let me say thank you for the very kind letter of appreciation. It was my goal from the beginning, and still is to share and educate to the best of my ability. The documentation for ExtendScript was, and kinda still is lacking to properly explain the process for a newcomer. I made the initial scripting training series over five years ago, and the Free Function Friday series not too long after that. I have been overwhelmed and surprised by the continuing support and praise by individuals like yourself over the years for these series. I never expected them… Read more »