Skip to main content
brandonb96942845
Inspiring
June 12, 2022
Question

"Value At Time" with Scale

  • June 12, 2022
  • 1 reply
  • 1636 views

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.

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
June 12, 2022

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

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

 

brandonb96942845
Inspiring
June 12, 2022

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