# Expression With Master Controls

### Example 1:

Property: position\
Controls: Slider\
Description: adjusts position with an x slider and y slider

```javascript
/*
===expression.lib functions===
addMaster('master layer');
addSliderControl('master','X Position',0);
addSliderControl('master','Y Position',0);
===expression.lib end functions===
*/
//set master
var master = thisComp.layer("master layer");
//get effects from target
var xSlider = master.effect("X Position")("Slider");
var ySlider = master.effect("Y Position")("Slider");
//set x Position
var x = value[0] + xSlider;
//set y position
var y = value[1] + ySlider;
[x,y]
```

### Example 2:

Property: rotation\
Controls: Slider, Angle\
Description: Sets the rotation to the angle \* the slider

```javascript
/*
===expression.lib functions===
addMaster('master layer');
addSliderControl('master','multiplier',0);
addAngleControl('master','rotation',10);
===expression.lib end functions===
*/
//set master
var master = thisComp.layer("master layer");
//get effects from target
var multi = master.effect("multiplier")("Slider");
var rot = master.effect("rotation")("Angle");
//set rotation
rot*multi
```

### Example 3:

Property: scale\
Controls: Slider, Checkbox\
Description: Add the slider value to base value when checkbox is ticked.&#x20;

```javascript
/*
===expression.lib functions===
addMaster('master layer');
addSliderControl('master','Increase Amount',100);
addCheckboxControl('master','Size Increase',0);
===expression.lib end functions===
*/
//set master
var master = thisComp.layer("master layer");
//get effects from target
var checkbox = master.effect("Size Increase")("Checkbox");
var increase = master.effect("Increase Amount")("Slider");
//set scale
if ( checkbox == 1 ) {	
    [value[0] + increase, value[1] + increase]
}else {	
    value;
}
```


---

# 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/example-expression/expression-with-master-controls.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.
