ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Set an expression value to a layers name.

FAQ   •   VIEW ALL
 Set an expression value to a layers name. on Mar 17, 2020 at 7:47:52 pm

Hi, friends!

I am looking a solution for a relatively simple problem, but I'm not sure if there is a solution.

I am using a plugin called Templater. Using that plugin, I can change a layers name using a Google Sheet, for example.

Because of that wanted to be able to change this expression by linking the "veloc" to another layers name.

This is the expression

veloc = 140;
x = position[0] + (time - inPoint) *veloc;
y = position[1];
[x,y]

Instead of "140" I wanted this value to be another layer's name. That way, I can use the Templater plugin to change the name of the layer, and this will change the velocity that the text changes.

That's basically what I'm trying to achieve, if I change the layer name to 20, I want the expression to set its velocity to 20.

Hope this is clear enough, thank you!

```veloc = 140; x = position[0] + (time - inPoint) *veloc; y = position[1]; [x,y]```

 Re: Set an expression value to a layers name.on Mar 17, 2020 at 11:05:41 pm

Like this maybe:

veloc = parseInt(thisComp.layer(1).name,10);
x = position[0] + (time - inPoint) *veloc;
y = position[1];
[x,y]

Dan

 Re: Set an expression value to a layers name.on Mar 17, 2020 at 11:44:19 pm

Thank you, Dan! Worked like a charm.

For other people that may end up with the same problem, I've also found that using the source text as a value works really well. Using this:

veloc = parseInt(thisComp.layer("layerName").text.sourceText)
x = position[0] + (time - inPoint) *veloc -300;
y = position[1];
[x,y]

Thanks again, Dan! You're the best.