Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scripting question: Keyframe Interpolation control beyond only 2 options

  • Scripting question: Keyframe Interpolation control beyond only 2 options

    Posted by Paul Duncan on March 27, 2013 at 8:57 am

    Hello

    I’ve been trying to write a script which changes keyframe interpolation / spatial interpolation to LINEAR.

    (Right click a position keyframe, click ‘keyframe interpolation’, see 4 options under ‘spatial interpolation’.

    However, I understand the scripting control to be: app.item(x).layer(j).position.setSpatialAutoBezierAtKey(i, false);

    …where the boolean value at the end toggles between ‘continuous bezier’, and ‘auto bezier’, and this does not give access to the other two options available via the GUI i.e., ‘Bezier’, and ‘Linear’.

    Can anybody advise on how to achieve my goal?

    Thanks!

    app.item(x).layer(j).position.setSpatialAutoBezierAtKey(i, false);

    Coen Rens replied 10 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Jessica Ma

    May 27, 2015 at 9:50 am

    Hi I would like to know that too – and how to change keyfrm interpolation in an expression to hold.

    basically to do this tutorial in script instead of one by one key

  • Jessica Ma

    May 27, 2015 at 9:51 am

    tutorial
    https://www.youtube.com/watch?v=Rp7yGSYZeiM

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Coen Rens

    October 17, 2015 at 1:34 pm

    Hi Paul,

    I’m aware that this response comes years after your post, but hopefully it’s useful for whoever finds this thread when searching for the same problem.

    I had the same problem and managed to solve it; the trick seems to be in the ‘setSpatialTangentsAtKey’ method

    In your case it would be:
    app.item(x).layer(j).position.setSpatialTangentsAtKey(i, [0,0,0], [0,0,0])
    where ‘i’ is the index of the key you wish to change, and the two arrays carry input for the tangents which are all set to zero. You can find a further explanation of this method on page 142 and 143 of the After Effects CS6 Scripting Guide.

    For me, setting all the tangents to 0 made the keyframes’ spatial interpolation show up as ‘Linear’ in the Keyframe Interpolation window, and caused the keyframes to behave as such.

    This solved my problem and should solve yours, I hope it helps someone else!

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