Expression with thisLayer Controls

for thisLayer you do not need to include a variable declaring it. However, for best practises I always find it a good idea to include it so the expression is easily editable in the future.

Example 1:

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

/*
===expression.lib functions===
addSliderControl('thisLayer','X Position',0);
addSliderControl('thisLayer','Y Position',0);
===expression.lib end functions===
*/
//set target
var target = thisLayer;
//get effects from target
var xSlider = target.effect("X Position")("Slider");
var ySlider = target.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

Example 3:

Property: scale Controls: Slider, Checkbox Description: Add the slider value to base value when checkbox is ticked.

Last updated

Was this helpful?