Property: position
Controls: Slider
Description: adjusts position with an x slider and y slider
/*
===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
/*
===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.
/*
===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;
}