Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rove across time - COLOR property

Contributor ,
Jun 03, 2019 Jun 03, 2019

If I try to set a keyframe in a color property to rove across time I get an error.

Property setRovingAtKey() method

app.project.item(index).layer(index).proper tySpec.setRovingAtKey(keyIndex, newVal)

Description

Turns roving on or off for the specified keyframe. The first and last keyframe in a property cannot rove; if you

try to set roving for one of these, the operation is ignored, and keyRoving() continues to return false.

If the property value type is neither TwoD_SPATIAL nor ThreeD_SPATIAL, an exception is generated.

However if I select the keyframe with my mouse and right click, I can select Rove across time and it works.

How's that? How can I achieve that by scripting?

TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jun 03, 2019 Jun 03, 2019

The description you supplied gives you the answer. Roving with the setRovingAtKey command works only on SPATIAL (that is, any kind of positional) values. For some reason Adobe does not allow you to rover any other type of value.

The first thing that comes in mind is to use the app.executeCommand with the CommandID 3153 (Rove Across time)

app.executeCommand(3153);

This would have the exact same effect, as right-clicking the keyframe and selecting the "Rove Across Time" option.

The second is a lot mor

...
Translate
Explorer ,
Jun 03, 2019 Jun 03, 2019

The description you supplied gives you the answer. Roving with the setRovingAtKey command works only on SPATIAL (that is, any kind of positional) values. For some reason Adobe does not allow you to rover any other type of value.

The first thing that comes in mind is to use the app.executeCommand with the CommandID 3153 (Rove Across time)

app.executeCommand(3153);

This would have the exact same effect, as right-clicking the keyframe and selecting the "Rove Across Time" option.

The second is a lot more complicated and dirty workaround.

You will have to create a 3D null, and "transfer" the separate R,G,B values of the three keyframes of the color property in question to the X,Y,Z values of a Null's 3D position. Then, Rove the second keyframe of the Null's Position, mark the new frame where AE moved the keyframe in the timeline and finally, move the second Color keyframe to the same frame in time.

In more detail, let's say you already have 3 keyframes set in a color property.

  1. Create a new 3D Null and:
    Create a new keyframe in the Null's 3D Position, in the same frame in the timeline as the first keyframe of your Color property, and copy the R,G and B value of the color property to the X,Y and Z values of Null's position, respectively. Do the same with the other 2 keyframes and their values.

  2. Then, Rove the second keyframe of the Null's position like so:

    app.project.item(1).layer("Null 1").transform.position.setRovingAtKey(2, true);

  3. Finally, set the second keyframe of your Color property to the same frame, as the second (roved) keyframe of the Null's Position and safely delete the Null.

This "solution" is far from perfect. As I said, just a dirty work-around.

I would stick with the app.executeCommand

Hope these solutions help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 04, 2019 Jun 04, 2019

Thank you TheodorosGR​, yes!, both solutions make sense and helped.

Regarding this line of code here:

  1. app.executeCommand(3153); 

Is there a database with all the CommandID ? In other words, where did you get this information from?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2019 Jun 04, 2019

There you go:

After Effects Menu Command ID’s by David Torno:

https://www.provideocoalition.com/after-effects-menu-command-ids/

At the bottom of the page there are links for .PDF files with all the available commands.

Cheers!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 04, 2019 Jun 04, 2019
LATEST

Oh wow thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines