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

nearestKeyIndex with time reversed layers

Advocate ,
Jan 04, 2015 Jan 04, 2015

Copy link to clipboard

Copied

i just observed a wierd behaviour of nearestKeyIndex with negatively stretched layers and am wondering whether this is intended:

setup: put a footage inside a comp, time reverse the layer, lay some position keyframes on that layer.

1- expression: add a slider control to the time reversed layer, with expression: "transform.position.nearestKey(time).index;",  scroll the CTI along the timeline and read the slider value: the first key on the timeline has max index, the last key has index 1...

2- script: var L=app.project.activeItem.layer(1); L.transform.position.nearestKeyIndex(L.containingComp.time);     If the CTI is placed after the last position key on the timeline, it returns L.transform.position.numKeys, which is expected. But anywhere else it gives 1 !

So, for expressions it is more or less ok, but it means that whenever one uses a "nearestKey" expression one should actually check the strech state of the layer...(if (layer.inPoint<layer.outPoint) {this} else {that};)

But the script function looks really bugged to me, unless i made something wrong. Can someone confirm that "observation" ?

The work around i have now is to precomp the footage, time reverse it inside the precomp, and animate the precomp. But i'd rather not do it like that.

Xavier.

TOPICS
Scripting

Views

645

Translate

Translate

Report

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

Community Expert , Jan 04, 2015 Jan 04, 2015

It appears to work just as you describe. Seems like a bug (at least the scripting part, but maybe both) to me.

Dan

Votes

Translate

Translate
Community Expert ,
Jan 04, 2015 Jan 04, 2015

Copy link to clipboard

Copied

It appears to work just as you describe. Seems like a bug (at least the scripting part, but maybe both) to me.

Dan

Votes

Translate

Translate

Report

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
Advocate ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

Thank you Dan for checking.

I'll quote it as answered since it makes me stop wondering about that problem, but i'll file a bug report along.

Xavier.

Side question:

I always use [layer].containingComp.time instead of just [layer].time, to be absolutely sure that it is the time i want, but everytime i check they appear to be the same.

Do you know if this is always true ?

Votes

Translate

Translate

Report

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
Community Expert ,
Jan 05, 2015 Jan 05, 2015

Copy link to clipboard

Copied

I'm not aware of a case where they can be different. I tried it with a layer open in its own viewer and changing one changes the other. I do always use the comp time though, just in case.  🙂

Dan

Votes

Translate

Translate

Report

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
Advocate ,
Jan 06, 2015 Jan 06, 2015

Copy link to clipboard

Copied

Ok. Sticking to comp.time too then. Thank you.

Xavier.

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 22, 2024 Feb 22, 2024

Copy link to clipboard

Copied

LATEST

still not fixed in Ae 2024 I guess

nearestKeyIndex works unexpected while layer time reversed

Votes

Translate

Translate

Report

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