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

Standard Expression

Example 1:

Property: position Description: Sets the X and Y to 100

//sets the x position
var x = 100;
//sets the y position
var y = 100;
[x,y]

Example 2:

Property: scale Description: times the scale by the comp time

//gets the comp time
var compTime = time;
//set the scale value
var scale = 100;
//times scale by time
var scaleMath = scale*compTime;
[scaleMath,scaleMath]

Example 3:

Property: rotation Description: rotate based on x position to comp

//get comp width
var compWidth = thisComp.width;
//get x position
var xPos = thisLayer.transform.position[0];
//set start rotation
var startRot = 0;
//set end rotation
var endRot = 360;
//rotate bewteen start and end based on comp X
linear(xPos, 0, compWidth, startRot, endRot)
PreviousExample ExpressionsNextExpression with thisLayer Controls

Last updated 5 years ago

Was this helpful?