# thisLayer & Master Layers

When creating custom controls within an expression you always have an option to select either **'thisLayer'** or a **'master'** layer.

## Understanding thisLayer and Masters

### What Is thisLayer?

If you haven't been writing expressions for long you may be unaware that you can reference a layer with a simple line: thisLayer basically means what it says, this layer.

```javascript
var target = thisLayer;
target.name;
```

{% hint style="info" %}
The variable doesn't matter in this situation. However, I like to set layers as targets to easily reference back to them for later.
{% endhint %}

### What Is Master?

A master layer referes to a layer that normally contains effect controlls for properties on other layers. Basically this means you are able to maipulate layers by using the master instead of having to find the layer itself. You can reference a master by doing the following

```javascript
var master = thisComp.layer("masterLayerName");
master.name;
```

{% hint style="info" %}
I like to set master variables inside the expression so I can quickly reference them again if I need to.
{% endhint %}

## Expression Set-up

The easiest way to explain how to set-up expressions to use masters or likewise. Head over to this sections

{% content-ref url="/pages/-Lq1hE4LcTv6KwAEvPov" %}
[Example Expressions](/adding-custom-controls/example-expression.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.expression-library.bearstudios.co.uk/adding-custom-controls/thislayer-and-master-layers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
