Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Keyframes Creation by Scripting

  • Keyframes Creation by Scripting

    Posted by Tomas Bumbulevičius on May 12, 2022 at 8:02 am

    Hey there! Have you noticed speed decrease in processing, when creating huge amounts of keyframes? If so, do you have any idea how to more efficiently do so, or its just a nature of JS framework?

    If you ever tried running lots of scripts in a single run, you probably already faced situation of call stack build-up. Thus wonder if there are ways to improve this in general, where it applies for keyframes creation on properties as well – the more task is being called during single execution, the slower it gets by the end.

    Thanks!

    Tomas Bumbulevičius replied 4 years ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 12, 2022 at 1:11 pm

    The only tip that comes to mind when generating a lot of keyframes, is to, whenever possible, create time and value arrays and use setValuesAtTimes() instead of looping through and doing individual setValueAtTime() operations.

  • Tomas Bumbulevičius

    May 13, 2022 at 4:35 am

    Hey Dan, thanks a ton! I never knew its possible to use setValueAtTime in plural! Will test it out and see how it goes – thanks for the hint!

  • Tomas Bumbulevičius

    May 17, 2022 at 1:28 pm

    In case if someone is interested in the topic further.

    Setting 1000 keyframes on a slider with setValueAtTime() takes ~1.5s
    Setting 2000 keyframes on a slider with setValueAtTime() takes ~3.7s
    Setting 4000 keyframes on a slider with setValueAtTime() takes ~11s

    Now with setValuesAtTimes() its a different story accordingly.

    Setting 1000 keyframes on a slider with setValuesAtTimes() takes ~0.3s
    Setting 2000 keyframes on a slider with setValuesAtTimes() takes ~0.45s
    Setting 4000 keyframes on a slider with setValuesAtTimes() takes ~0.48s

    As mentioned, the more you repeat the same action during the single execution, the slower it gets.

    BUT the solution Dan has shared opens broad horizons ahead to speed up the workflows. Not only it only slows down by a fraction, its A HELL LOT faster! Thank you, Dan, its a fortune!!!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy