"Value At Time" with Scale

Participant ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

Hopefully a quick and easy one this time. Short version: I'm trying to pull the value of a layer's scale at a specific time onto a slider, but I'm getting an error when I try to apply the expression. This is the expression syntax I've got:

 

temp2 = thisComp.layer(index-3).transform.scale[0].valueAtTime(10);

 

So basically what I'm trying to do is define a variable that'll pull the "X" scale of the layer (the slider is on a different layer if that makes a difference), but since it shifts at the start of the comp, I want it to pull a value from 10 seconds in after everything's settled down. But I can't seem to make AE happy.

 

If I leave off the "[0]", it says the result has to be of dimension 1, not 3 (it's a 3D layer in a Classic 3D space if that makes a difference, the layer I'm trying to pull it to is just a standard 2D layer). But when I add the "[0]", it says everything after temp2 (which is the variable I'm defining) isn't a function.

 

I'm slowly getting the hang of using and troubleshooting expressions, but I need help on this one.

TOPICS
Error or problem , Expressions

Views

34

Likes

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
Adobe Community Professional ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

You just need to switch the syntax around a little. Try it this way:

temp2 = thisComp.layer(index-3).transform.scale.valueAtTime(10)[0];

 

Likes

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
Participant ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

LATEST

Dan Ebberts for the win as usual! It never even occurred to me to put the dimension indicator at the end. Thanks a million!

Likes

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