Expression Library Guide
  • After Effects - Expression Library
  • Expression Library UI Overview
    • Import To Expression Library
    • Export Expression Library
      • Adding An Item To Export
      • Removing An Item From Export
      • Exporting
    • Guide
    • Expression Library
      • Expression Library Item Icon Guide
    • Information
    • Expression Functions
    • Add Expression Library Item
    • Remove Expression Library Item
    • Apply Expression
      • Applying To Properties
      • Applying To Layers
    • Delete Expression
      • Deleting With Combined Effects
  • Creating An Expression Library Item
    • Expression Library Info
    • Selection
      • Single Property Selection
      • Multiple Property Selection
      • Layer Selection
    • Including Keyframes
    • 3D or 2D Layer
    • Javascript or Extendscript
    • Naming Your Expression
  • Adding Custom Controls
    • thisLayer & Master Layers
    • Custom Functions
      • addMaster()
      • add3DPointControl()
      • add2DPointControl()
      • addColorControl()
      • addCheckboxControl()
      • addSliderControl()
      • addAngleControl()
      • addLayerControl()
    • Combining Custom Controls
    • Example Expressions
      • Standard Expression
      • Expression with thisLayer Controls
      • Expression With Master Controls
  • Tutorials
    • Tutorial Series 01
  • Changelog
    • Updates
  • Expression Pack
    • COMING SOON
  • FAQ
    • Installing The Script
      • Install As A Script Panel
      • Avoiding Those Darn Errors
      • Loading The Script
    • Reporting A Problem
    • After Effects Expression Error
    • Supported Versions
Powered by GitBook
On this page
  • Example 1:
  • Example 2:
  • Example 3:

Was this helpful?

  1. Adding Custom Controls
  2. Example Expressions

Expression With Master Controls

Example 1:

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;

}
PreviousExpression with thisLayer ControlsNextTutorial Series 01

Last updated 5 years ago

Was this helpful?