The Creative Expression Library Glossary

Contents

Categories: Text Styles | Text Inputs | Typography | Objects | Controls | General

Individual Functions: adjustBrightness | adjustHue | adjustSaturationautoScaleAtTime | createDynamicMask | flipHorizontal | flipVertical | formatCurrencyEU | formatCurrencyUS | formatNumber | getCompSize | getLayerCorners | getLayerHeight | getLayerScale | getLayerSize | getLayerRotationgetLayerWidth | getPointOnLayer | getStyleOnly | getTextAndStyle | getTextOnly | itemFromDropdownMenu | keyframesToControllers | loopInOut | loopInOutPath | loopInPath | loopOutPath | retimeKeyframes | roundToWholeNumbers | selectCharacters | selectLines | selectWords | separateDimensions | setAnchorPointTo | setLineHeight | toggleFromDropdownMenu | toggleWithCheckbox | useTimeBetween

Overall Notes

Arguments

Most functions in the Creative Expression Library require specific arguments inside the function to operate without error. Select functions can work directly on a property and do not require any arguments. They are:

  • createDynamicMask
  • flipHorizontal
  • flipVertical
  • getCompSize
  • keyframesToControllers
  • loopInOut
  • loopInPath
  • loopOutPath
  • loopInOutPath
  • roundToWholeNumbers

"atTime" Performance Note

For all functions in the Creative Expression Library, the atTime argument is optimized to only sample the size of the layer once by default. To optimize performance, only set the atTime argument if the Source Text or Shape Layer rect is changing over time or set to the time when the layer is at its final size.

You may use time to always use the current time, however this is a more intense calculation and will cause performance drops. If you use time this behaves like the native function sourceRectAtTime.

Boolean values

Any argument that is defined as true or false is a boolean value, and can be easily linked to a Checkbox control to turn it "on" or "off."

Text Styles

getStyleOnly

getStyleOnly(textLayer, atChar, atTime)

Use the getStyleOnly function to get only the style of another text layer, but not the source text. Use on a Source Text property.

Arguments accepted:

  • textLayer: Name of Source Text layer (either from the same comp or a different comp)
  • atChar: Optional. Get text style at a specific character index.
  • atTime: Optional. Get text style at specific timecode (in seconds). Useful for a Source Text layer with keyframes.

Example Expression used on Source Text property of Target layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getStyleOnly(thisComp.layer("My Text Layer"));

________________________________________

getTextOnly

getTextOnly (textLayer, atTime)

Use this function to get only the Source Text of another text layer but not the style. Use on a Source Text property.

Arguments accepted:

  • textLayer: Name of Source Text layer (either from the same comp or a different comp)
  • atTime: Optional. Get text style at specific timecode (in seconds). Useful for a Source Text layer with keyframes.

Example Expression used on Source Text property of Target layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getTextOnly(thisComp.layer("My Text Layer"));

________________________________________

getTextAndStyle

getTextAndStyle (textLayer, atChar, atTime)

Use this function to get the Style and Source Text of another text layer. Use on a Source Text property.

Arguments accepted:

  • textLayer: Name of Source Text layer (either from the same comp or a different comp)
  • atChar: Optional. Get text style at a specific character index.
  • atTime: Optional. Get text style at specific timecode (in seconds). Useful for a Source Text layer with keyframes.

Example Expression used on Source Text property of Target layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getTextAndStyle(thisComp.layer("My Text Layer"));

With additional arguments for character and time:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getTextAndStyle(thisComp.layer("My Text Layer"), 2, 4);

Text Inputs

selectLines

selectLines (thisLayer, lineNumber)

This function is used to split text lines within a paragraph of text. This can be utilized to create a singular Source Text controller to drive multiple text layers animating at different times. The end user will use a new line break to feed the text to a different layer. This is useful for promo videos with lots of text. Use on a Source Text property.

Arguments accepted:

  • thisLayer: A text input. Either thisLayer or the name of a Source Text layer (either from the same comp or a different comp)
  • lineNumber: As many numbers as needed for the desired line(s) from the Text Layer, separated by commas.

Example Expression on Target Layer 1:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.selectLines(thisComp.layer("Source Paragraph"), 2, 4);

Note: If the number input in the lineNumber argument is greater than the available number of lines, the function will error. Clicking the "warning" dialog will report the maximum number of lines in your text layer.

________________________________________

selectWords

selectWords (thisLayer, wordNumber)

This function selects words based on their order within a text input. This can be utilized to create a singular Source Text controller to drive multiple text layers animating at different times. This is useful for promo videos with lots of text. A 'word' is defined by the characters between spaces and includes punctuation. Use on a Source Text property.

If multiple numbers are added to the argument to return multiple words, they will be selected together separated by a space.

Example: If the expression is set up to return words 1, 5, 18, and 19, Lorem amet magna aliqua will be selected.

Arguments accepted:

  • thisLayer: A text input. Either thisLayer or the name of a Source Text layer (either from the same comp or a different comp)
  • wordNumber:As many numbers as needed for the desired word(s) from the Text Layer, separated by commas.

Example Expression on Target Layer 1:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.selectWords(thisComp.layer("Source Text"), 1, 3, 7);

Note: If the number input in the wordNumber argument is greater than the available number of words, the function will error. Clicking the "warning" dialog will report the maximum number of words in your text layer.

________________________________________

selectLines in combination with selectWords

selectLines can be used with selectWords to choose words based on order within the whole paragraph (not specific to lines themselves).

Note: adding "\n" creates a new line break

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.selectLines(thisComp.layer("Source Paragraph"), 4, 5) + "\n" + createLib.selectWords(thisComp.layer("Source Paragraph"), 3, 7, 10);

________________________________________

selectCharacters

selectCharacters (thisLayer, characterNumber)

This function selects characters based on their order within a text Input. This can be utilized to create a singular Source Text controller to drive multiple text layers animating on at different times.

  • If multiple numbers are added to the argument to return multiple characters, all characters will be joined together
  • Spaces are excluded from character selection (numbering)

Arguments accepted:

  • thisLayer: A text input. Either thisLayer or the name of a Source Text layer (either from the same comp or a different comp)
  • characterNumber: As many numbers as needed for the desired character(s) from the Text Layer, separated by commas.

Example of the expression on Target Layer 1:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.selectCharacters( thisComp.layer("Source Text"), 1, 3, 7);

Note: If the number input in the characterNumber argument is greater than the available number of characters, the function will error. Clicking the "warning" dialog will report the maximum number of characters in your text layer.

Typography

setLineHeight

setLineHeight(value)

Use this function to set or adjust the vertical line spacing (leading) in a block of text. Use on the Line Spacing text animator property on a text layer.

Arguments accepted:

  • sliderOrNumberHere: A value. Rig a Slider Control to control.

Example Expression on the Line Spacing property on a Text Layer

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.setLineHeight(effect("Line Height")("Slider") );

Objects

flipHorizontal

flipHorizontal(boolean)

Use this function to flip a layer horizontally. Use on the Scale property.

Arguments accepted:

  • enableFlip: Optional. Boolean that defaults to true. Can use a Checkbox Control to drive switch from 1 to 0.

Example Expression on the Scale property of a layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.flipHorizontal();

With additional arguments for Checkbox control:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.flipHorizontal(effect("Checkbox Control")(1));

________________________________________

flipVertical

flipHorizontal(boolean)

Use this function to flip a layer vertically. Use on the Scale property.

Arguments accepted:

  • enableFlip:Optional. Boolean that defaults to true. Can use a Checkbox Control to drive switch from 1 to 0.

Example Expression on the Scale property of a layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.flipVertical();

With additional arguments for Checkbox control:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.flipVertical(effect("Checkbox Control")(1));

________________________________________

setAnchorPointTo

setAnchorPointTo(anchorPointLocation, atTime)

Use this function to align the anchor point to any of the nine points on its layer. Use on an Anchor Point property.

Arguments accepted:

  • anchorPointLocation: a string that defines which if the nine points on the layer. Use any combination of "center", "left", "right", "top", and "bottom".
  • atTime: Optional. A number that represents at which timecode (in seconds) to analyze the layer bounds.

Example Expression on an Anchor Point property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.setAnchorPointTo("topright");

Use this function in combination with autoScaleAtTime or getPointOnALayer to align anchor points to other layers or specific points of another layer.

setAnchorPointTo for Text Layers

When aligning multiple text layers, setAnchorPointTo can break the baselines if your text layer has descenders. To match baselines, you can return the X-value with the setAnchorPointTo function and manually set the Y-value to 0:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData;[createLib.setAnchorPointTo("bottom") [0], 0]

________________________________________

separateDimensions

separateDimensions(xValue, yValue, zValue)

Use this function to split the dimensions for properties to link each individual value to its own expression control. Most commonly used on Position, Scale, and Size properties, and may be used on Orientation and Color properties.

Arguments accepted:

  • xValue: Hard-coded number or a Slider Control.
  • yValue: Optional. Hard-coded number, or a Slider Control.
  • zValue: Optional, for 3D layers only. Hard-coded number, or a Slider Control.

Notes on Arguments:

  • If only the xValue is made, then the yValue will keep its pre-expression value if this function is used on Position or Orientation properties.
  • To control only the yValue and leave the xValue as is, add value[0] to the xValue argument.
  • To leave the yValue as is, add value[1] to the yValue argument.
  • To leave the zValue as is, add value[2] to the zValue argument.

Example Expression on Scale property using Sliders on a Control Layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.separateDimensions( thisComp.layer("Control Layer").effect("X Scale")("Slider"),thisComp.layer("Control Layer").effect("Y Scale")("Slider"));

Notes on Color properties:

  • To use this function to rig Sliders to a Color Property (separate R, G, B), change the Range of the Value of the slider to min = 0 and max = 1. AE defaults to using a number between 0.0 - 1.0 to represent each value of R, G, and B.
  • xValue will link to Red, yValue links to Green, and zValue links to Blue

Example Expression on Color property using hard-coded numbers and a Slider Control:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.separateDimensions(0.04, 0.52, effect("Slider Control")("Slider"))

________________________________________

autoScaleAtTime

autoScaleAtTime(targetLayer, atTime, scaleProportionally, paddingXY, paddingY)

Use this function to match the scale of one layer to another layer. This function can be used on the Scale property of a layer, the Scale property of a Shape Group, or the Size property of a Shape layer.

Arguments accepted:

  • targetLayer: Pickwhip to the layer you want to scale to.
  • atTime: Optional. Argument needs a number that represents at what time you want to analyze the Layer bounds. Defaults to 0.
  • scaleProportionally: Optional. True or false arg. Defaults to "true."
  • paddingXY: Optional. Amount of padding on X axis and Y axis as well if no value is given for paddingY.
  • paddingY: Optional. Amount of padding for Y if different than padding for X.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.autoScaleAtTime( thisComp.layer("Source Text"), 3, false, effect("Padding")("Slider") );

________________________________________

Controls

toggleWithCheckbox

toggleWithCheckbox(checkboxHere, offValue, onValue)

Use this function to toggle between two values with a checkbox. Use on the Transform property, works with 3D layers.

Arguments accepted:

  • checkboxHere: Pickwhip to a Checkbox Expression control on the same layer or a Control Layer. Using only checkboxHere argument will toggle the property's value.
  • offValue: the value of a disabled checkbox. Defaults to 0. Accepts value to be used as the property's current value. Values need to be an Array if used on Anchor Point, Position, or Scale properties.
  • onValue: the value of an enabled checkbox. Defaults to current value if no argument is given. Accepts value to be used as the property's current value. Values need to be an Array if used on Anchor Point, Position, or Scale properties.

Example Expression used on Position property using the current value and math to change x & y values:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.toggleWithCheckbox(effect("Checkbox Control")("Checkbox"), value - [0,100], [value + [200,0] );

________________________________________

itemFromDropdownMenu

itemFromDropdownMenu(dropdownMenu, item 1, item 2, item 3)

Use this function to switch between strings, values, controls, comps, etc., with a Dropdown Expression Menu. Use on nearly any property.

  • The on and off values must be consistent with the property that the function is being used on.
  • Use this on a Text Layer to switch between specific strings like "Cats", "Dogs", "Hedgehogs", "Goats."
  • Use on a property to define specific values. These must be an array if the property requires.
  • Use on a property with keyframes to switch between specific keyframes.

Arguments accepted:

  • dropdownMenuHere: Pickwhip to a Dropdown Menu on the same layer or a control layer.
  • item1: the first Dropdown Menu item.
  • item2: the second Dropdown Menu item.
  • Continue adding values separated by commas, for as many items as there are in the Dropdown Menu. An error will occur if there are more arguments than there are items in the Dropdown Menu.

Example Expression on the Source Text property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.itemFromDropdownMenu( effect("Dropdown Menu Control")("Menu"), "Cats", "Dogs", "Hedgehogs", "Tigers", "Elephants", );

Example Expression on the Scale property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; itemFromDropdownMenu(thisComp.layer("Controls").effect("Dropdown Menu Control")("Menu"), [100,100], [25,25], [75,75], );

Example Expression of switching between different keyframes on a value:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.itemFromDropdownMenu( effect("Dropdown Menu Control")("Menu"), key(1).value, key(2).value, key(3).value, key(4).value, key(5).value, key(6).value, );

Example Expression to switch fonts:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const theStyle = thisProperty.createStyle(); createLib.itemFromDropdownMenu(effect("Dropdown Menu Control")("Menu"), theStyle.setFont("Vortice-Concept"), theStyle.setFont("Continuo"), theStyle.setFont("Amboy-Inline"), );

________________________________________

toggleFromDropdownMenu

toggleFromDropdownMenu(dropdownMenuHere, targetIndex, offValue, onValue)

Use this function to toggle between strings, values, controls, comps, etc., with a Dropdown Expression Menu. Use on nearly any property.

  • The on and off values must be consistent with the property that the function is being used on.
  • Use on a Text Layer to switch between specific strings like "Cats" and "Dogs."
  • Use this function on the Opacity property to switch between comp or layer visibility.

Arguments accepted:

  • dropdownMenu: Pickwhip to a Dropdown Menu control on the same layer or a control layer.
  • targetIndex: A number that matches the Dropdown Menu index to trigger the onValue when the Dropdown Menu is set to that item.
  • offValue: value when the Dropdown Menu is not set to the number defined by the targetIndex argument. Accepts value to use the property's current value. Values need to be an Array if used on Anchor Point, Position, or Scale; use a third value in the Array if used on a 3D layer. Defaults to 0 if no argument is given.
  • onValue: the value desired for when the Dropdown Menu is set to the targetIndex argument. Accepts value to be use the property's current value. Values need to be an Array if used on Anchor Point, Position, or Scale; use a third value in the Array if used on a 3D layer. Defaults to the Current Value if no argument is given.

Example Expression used on a Source Text property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.toggleFromDropdownMenu ( thisComp.layer("Null").effect("Dropdown Menu Control")("Menu"), 2, "Cats", "Dogs" );

Example Expression used on a Position parameter:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.toggleFromDropdownMenu(thisComp.layer("Controller").effect("Dropdown Menu Control")("Menu"), 1, [100,500], value, );

Example Expression used on Scale where the Y value is driven by a Slider Control:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.toggleFromDropdownMenu( thisComp.layer("Null").effect("Dropdown Menu Control")("Menu"), 1, [50,80], [value [0], thisComp.layer("Null").effect("Y Scale")("Slider")] );

________________________________________

roundToWholeNumbers

roundToWholeNumbers(sliderOrNumber)

roundToWholeNumbers is a more flexible version of the built-in Math.round. Use this function to round any value or array of values to whole numbers. Use on a Slider Control to round its output to whole numbers or use with an expression to round values to whole numbers.

Arguments accepted:

  • sliderOrNumber: Optional value. Rig a Slider property, or enter a number or an array of numbers.

Example of Expression on a Slider Control or Source Text Property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.roundToWholeNumbers();

Example of Expression on a property getting values from a Position property:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.roundToWholeNumbers(transform.position);

________________________________________

keyframesToControllers

keyframesToControllers(controlLayer = thisLayer, customPrefix)

This function is used to connect Expression Controls to keyframes themselves so that the end user in Premiere Pro can change the values of individual keyframes while preserving the animation style (curves and easing are maintained across value changes).

It replaces the value of a keyframe with the value of the corresponding expression controller.

  • The function has to be mapped to a type of controller that matches the keyframed parameter, i.e. if the keyframes are on a color, then you need to use a Color Control.
  • This function takes one or two arguments: one to set the layer where the expression controls exists and one to set a custom prefix for those controls if you don't want to use the default property name ( or need the function to work in After Effects running another language )
  • Note: these arguments can be used individually or in combination
  • If you leave the parenthesis empty, the arguments will default to the equivalent of thisLayer and controls will need to be named by Property Name + index of keyframe
  • You can use the hamburger menu for the comp in the timeline panel and enable "Use Keyframe Indices" to see what number a keyframe is in the UI instead of the little blue diamond.

Arguments accepted:

  • controlLayer: Optional. A layer object where the expression controls live. For example, a control Null.
  • customPrefix: Optional. A different prefix for the expression control which drives the keyframe values.

controlLayer

By default, keyframesToControllers will look for expression controls on thisLayer. However, you may use this argument to tell the function to look at any other layer for these controllers.

  • Use a Null as a control layer where all of the Expression Controls for the keyframes will live
  • You will use the reference to the Control Layer as your Argument—Example: thisComp.layer("Control Null")
  • Name the controls by the parameter the keyframes are on + the index number of the keyframe—Example: "Position 2" or "Scale 4"
  • You can also control multiple keyframes with one control by adding all of the desired keyframe indexes and leaving a space between the numbers—Example: "Position 2 3" will set both keyframes 2 and 3 to whatever value you make the Expression Control.

Example of the Expression on the Position of a Layer using the customLayer argument:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.keyframesToControllers( thisComp.layer("Control Null") );

customPrefix

Allows the user to use a custom name for their expression controllers (i.e. "Awesome Color") which would be followed by the index(es) of the keyframe(s) which should be replaced by the controller's value.

  • You add the controls to the layer itself and add (thisLayer, "Awesome Color"); to the second argument.
  • You are required to add a number to correspond to the keyframe you want to control on that parameter.
  • Example: Name your expression controller "Awesome Color 4" to replace the fourth keyframe, or name it "Awesome Color 4 5 8 9" to replace keyframes with indexes 4, 5, 8, and 9.

It will continue mapping every new control on the layer with the new keyframe as long as the control has the customPrefix.

Example of the Expression on the Color Parameter with Keyframes using the customPrefix argument:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.keyframesToControllers( thisLayer, "Awesome Color");

Important Cross-language Note:

For this expression function to work in After Effects running in different languages, the customPrefix argument must be set. Otherwise, the default behavior of looking for expression controls which match the property name will break. This is because the property names in the Timeline will change to match the app language, but the expression control names will still be in the original author's language.

Errors Note: If a warning about "no value change between keyframes" is shown, it can be disabled by setting "showWarnings = false" in the expression itself like this:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; showWarnings = false; createLib.keyframesToControllers( thisComp.layer("Control Null"));

This means that the two keyframes have the same value and there is no easing between them to drive the easing in the function, so a linear interpolation will be used instead.

________________________________________

formatNumber

formatNumber(theNumber, useCommas, decimalPlaces)

Use this function to format numbers with commas and decimal places. This function automatically adds commas to numbers greater than 999. This function can also display decimal places and set how many decimal points to display.

The number value can be hard-coded or fed to this function by a Source Text layer or a Slider Control The expression will break if the Source Text value isn't a number, such as letters.

Arguments:

  • theNumber: Hard-coded number, number from a Source Text layer, number from a slider or expression control, number from a pick-whipped property.
  • useCommas: Optional. Boolean that defaults to true. Adds a comma to numbers greater than 999 (Example: 1,000).
  • decimalPlaces: Optional. Defaults to 0 (no decimals) if no argument is given. Allows users to set how many digits to show after the decimal point.

Note: By default, the number will be formatted with commas and without decimals.

Example of expression with a Slider Control providing the number:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.formatNumber(effect("Slider Control")("Slider"), true, 2);

________________________________________

formatCurrencyUS

formatCurrencyUS(theNumber, currencyType, useCommas, showDecimals)

Use this function to format a number as currency, and to add commas or decimals. The number value can be fed to this function from a Source Text layer, a slider control, or hard coded. Use formatCurrencyEU() to swap commas and decimals.

Arguments accepted:

  • theNumber: A hard-coded number, number from a Source Text layer, number from a slider control or expression control, or number from a pick-whipped property.
  • currencyType: Optional. "dollar" , "euro" , "pound" , "yen" , "yuan."
  • useCommas: Optional. Boolean that defaults to true. Adds a comma to numbers greater than 999 (Example: 1,000).
  • showDecimals: Optional. Boolean that defaults to true. Allows users to show or hide decimals.

Note: If only the first argument is given, the number will be formatted in dollars with commas and cents.

Example Expression: on a Text layer with Slider Control providing the number:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.formatCurrencyUS( effect("Slider Control")(1), "yen", true, false)

________________________________________

formatCurrencyEU

formatCurrencyEU(theNumber, currencyType, useDecimals, showCommas)

Use this function to format a number as currency, and to add commas or decimals. The number value can be fed to this function from a Source Text layer, a slider control, or hard coded. Use formatCurrencyUS() to swap commas and decimals.

Arguments accepted:

  • theNumber: A hard-coded number, number from a Source Text layer, number from a slider control or expression control, or number from a pick-whipped property.
  • currencyType: Optional. "euro" , "dollar" , "pound" , "yen" , "yuan."
  • useDecimals: Optional. Boolean that defaults to true. Adds decimals to numbers greater than 999 (Example: 1,000).
  • showCommas: Optional. Boolean that defaults to true. Allows users to show or hide commas.

Note: If only the first argument is given, the number will be formatted in euros with decimals and cents.

Example Expression: on a Text layer with Slider Control providing the number:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.formatCurrencyEU( effect("Slider Control")(1), "yuan", true, false)

________________________________________

adjustHue

adjustHue(inputColor, adjustmentValue)

Use this function to shift the hue of color values across layers based on a root color. This function can be nested within other color adjustment functions to get really wild.

Arguments accepted:

  • inputColor: Hex Value, RGBA array, or a Color Expression Control. Value can also be used.
  • adjustmentValue: A Number. Can be provided by a hard-coded value, a Slider control, the index number from layer order. The number represents a Percentage of change in hue from the root inputColor.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.adjustHue(thisProperty, 50)

adjustSaturation

adjustSaturation(inputColor, adjustmentValue)

Use this function to shift the saturation of color values across layers based on a root color. This function can be nested within other color adjustment functions to get really wild.

Arguments accepted:

  • inputColor: Hex Value, RGBA array, or a Color Expression Control. Value can also be used.
  • adjustmentValue: A Number. Can be provided by a hard-coded value, a Slider control, the index number from layer order. The number represents a Percentage of change in brightness from the root inputColor.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.adjustSaturation(thisProperty, 50)

adjustBrightness

Use this function to shift the brightness of color values across layers based on a root color. This function can be nested within other color adjustment functions to get really wild.

Arguments accepted:

  • inputColor: Hex Value, RGBA array, or a Color Expression Control. Value can also be used.
  • adjustmentValue: A Number. Can be provided by a hard-coded value, a Slider control, the index number from layer order. The number represents a Percentage of change in brightness from the root inputColor.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.adjustBrightness(thisProperty, 50)

General

createDynamicMask

createDynamicMask(paddingXY, paddingY, offsetX, offsetY, atTime, includeExtents)

Use this function on a Mask Path to dynamically resize the mask to the layer it is applied to. Returns a Mask Path that follows the bounds of the layer that it is applied to across changes to the layer's properties (i.e. text string), spatially, and over time.

Arguments accepted:

  • paddingXY: Optional, defaults to 0. Amount of padding will be applied to both X and Y.
  • paddingY: Optional. Use if you want the padding of Y to be different than the padding of X.
  • offsetX: Optional. Accepts a number or slider to offset the mask path horizontally.
  • offsetY: Optional. Accepts a number or slider to offset the mask path vertically.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.
  • includeExtents: Optional. Set to true if you want to get the extents of a Layer. Defaults to false.

Example Expression on Mask Path, with a Slider to control padding of X and Y:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.createDynamicMask(effect("Slider Control")("Slider"));

Example Expression on Mask Path, with multiple Sliders and outPoint for time:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.createDynamicMask( effect("Padding X")("Slider"), effect("Padding Y")("Slider"), effect("Offset X")("Slider"), effect("Offset Y")("Slider"), outPoint )

________________________________________

retimeKeyframes

retimeKeyframes(shiftStart, shiftEnd, startKeyIndex, endKeyIndex)

Use this function to shift keyframe values in time on a layer while preserving easing. Returns the retimed values of the Property's keyframes.

For example, retimeKeyframes(1, -3, 2, 5) will retime the animation of keyframes 2 through 5 to start 1 second later and 3 seconds earlier, while smoothly blending it with the animation of other keyframes before and after.

Notes:

  • Use a single argument to retime all animation to begin earlier or later.
  • Use two arguments to retime the start/end of all animation by different amounts.
  • Provide a third argument to retime only keyframes with that index or higher.
  • Provide a fourth argument to only retime a specific range of keyframes.

Arguments accepted:

  • shiftStart: Number. How much to shift the start of any keyframed animation. Can be hardcoded or provided by an expression control.
  • shiftEnd: Number. How much to shift the end of any keyframed animation. Can be hardcoded or provided by an expression control.
  • startKeyIndex: Number. The index of the first keyframe to have its animation retimed.
  • endKeyIndex: Number. The index of the last keyframe to have its animation retimed.

Example of using a "switch" statement to provide 4 different retimed animation options:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const numOfArgs = effect("Number of args")("Slider"); switch ( numOfArgs.value ) { case 0: createLib.retimeKeyframes() break; case 1: // Single Arg - Shift all keyframes createLib.retimeKeyframes( effect("Shift Start")("Slider") ); break; case 2: // Two Args - Shift all keyframes start and end to new times createLib.retimeKeyframes( effect("Shift Start")("Slider"), effect("Shift End")(1) ); break; case 3: // Three Args - Shift given keyframe index through end to new start/end times createLib.retimeKeyframes( effect("Shift Start")("Slider"), effect("Shift End")(1), 2 ); break; case 4: default: // Four Args - Shift keys between given index to new start/end times createLib.retimeKeyframes( effect("Shift Start")("Slider"), effect("Shift End")(1), 2, 3 ); }

________________________________________

getCompSize

getCompSize(targetComp)

Use this function to find the size of a composition. Returns an array of numbers; the width and height of a given comp. This is useful for conditionals which change depending on the size of the composition, rather than adding expression controls for the same purpose.

Arguments accepted:

  • theComp: Optional. A Composition object. Defaults to the current comp.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getCompSize(comp("Some Comp Name"))

________________________________________

getLayerScale

getLayerScale(targetLayer, atTime]

Use this function to get the true Scale of a Layer (prior to scaling via parenting).

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the scale of.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.

Note: Only works for x & y scale.

Example Expression on the Scale property of a layer looking for scale of another layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getLayerScale(thisComp.layer("SHAPE"));

________________________________________

getLayerWidth

getLayerWidth(targetLayer, atTime, includeExtents)

Use this function to get only the Width or X value of a Layer, regardless of whether the Layer is parented or scaled, raster or vector.

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the width of.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.
  • includeExtents: Optional. Defaults to false. Set to true to get the extents of a Layer.

Example Expression on the Size property of a Shape layer to match it to the width of a Text Layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; var x = createLib.getLayerWidth(thisComp.layer("TEXT LAYER")); [x, value[1]]

________________________________________

getLayerHeight

getLayerHeight(targetLayer, atTime, includeExtents)

Use this function to get only the Height or Y value of a Layer, regardless of whether the Layer is parented or scaled, raster or vector.

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the height of.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.
  • includeExtents: Optional. Defaults to false. Set to true to get the extents of a Layer.

Example Expression on the Size property of a Shape layer to match it to the height of a Text Layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; var x = createLib.getLayerWidth(thisComp.layer("TEXT LAYER")); [x, value[1]]

________________________________________

getLayerSize

getLayerSize(targetLayer, atTime, includeExtents)

Use this function to get the pixel height & width of a Layer.

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the size of.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.
  • includeExtents: Optional. Defaults to false. Set to true to get the extents of a Layer.

Example Expression on the Size property of a Shape layer to match it to the size of a Text Layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getLayerSize(thisComp.layer("TEXT LAYER"), 0, true);

________________________________________

getLayerRotation

getLayerRotation(targetLayer, atTime)

Use this function to get the true Rotation of a Layer. The value given is also clamped to the degrees of one rotation -180 - 180 and does not add the number of rotations to the degrees. Only works on 2D layers.

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the rotation of.
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.

Example Expression on the Opacity property of one layer driven by the Rotation of another layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getLayerRotation(thisComp.layer("Shape"));

________________________________________

getPointOnLayer

getPointOnLayer(targetLayer, pointName, atTime, includeExtents)

Use this function to get any of the nine points on a layer to link objects / effects or to draw paths / mask paths with. Returns an array of the 2D or 3D position of the requested point.

Arguments accepted:

  • targetLayer: Pickwhip to the Layer you want to get the size of.
  • pointName: a string that defines which of the nine points on the layer. Use any combination of "center", "left", "right", "top", and "bottom" to define the point. i.e. "centerleft" or "bottomright"
  • atTime: Optional. Defaults to 0. A number that represents at which timecode (in seconds) to analyze the layer bounds.
  • includeExtents: Optional. Defaults to false. Set to true to get the extents of a Layer.

Example Expression on the Position property of a Shape Layer to link to the corner of another shape:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.getPointOnLayer(thisComp.layer("Target Shape"), "topleft" );

Example Expression on the Start & End points of the Beam Effect to link to specific points on another layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const targetLayer = thisLayer; createLib.getPointOnLayer( targetLayer, "center" );

End:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const targetLayer = thisLayer; createLib.getPointOnLayer( targetLayer, "topleft" );

Example Expression of creating a path on the Path property of a Shape Layer:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const targetLayer = thisComp.layer("Target Shape"); showWarnings = false; createPath( [ createLib.getPointOnLayer( targetLayer, "top" ), createLib.getPointOnLayer( targetLayer, "right" ), createLib.getPointOnLayer( targetLayer, "bottom"), createLib.getPointOnLayer( targetLayer, "left" ), ], [], [], true )

________________________________________

getLayerCorners

getLayerCorners(targetLayer, atTime, includeExtents, paddingXY, paddingY)

Use this function to get all four corner points of a layer. Returns an object with four attributes as arrays: topLeft, topRight, bottomLeft, bottomRight.

Arguments accepted:

  • targetLayer = Pickwhip to the Layer you want to get the size of.
  • atTime: - Optional. Argument needs a number that represents at what time you want to analyze the Layer bounds. Defaults to 0.
  • includeExtents: Optional. Set to true if you want to get the extents of a Layer. Defaults to false.
  • paddingXY: Optional. Amount of padding on X axis and Y axis as well if no value is given for paddingY.
  • paddingY: Optional. Amount of padding for Y if different than padding for X.

Example of using this function to read the layer corners and then feed those values to createPath function:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; const cornerPoints = createLib.getLayerCorners( thisLayer, undefined, undefined, effect("Box Padding")("Slider") ); createPath( [ cornerPoints.topLeft, cornerPoints.topRight, cornerPoints.bottomRight, cornerPoints.bottomLeft, ], [], [], true )

________________________________________

loopInOut

Use this function to loop property value in and out with one function. Returns a looped property value.

Arguments accepted:

  • loopType: A string; one of "cycle", "pingpong", "continue", or "offset"
  • outType: Optional. Same string options as loopType. Will default to the same type as loopType if not given.

Example Expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.loopInOut("offset", "pingpong");

loopInPath | loopOutPath | loopInOutPath

loopInPath (type, numKeyframes, matchNativeLoopFuncJump)loopOutPath (type, numKeyframes, matchNativeLoopFuncJump)loopInOutPath (type, numKeyframes, matchNativeLoopFuncJump)

Use this function to loop a Path property, in the same style as the native loopIn / loopOut functions. Returns the looped value of the Path property's keyframes.

Note:

Without any arguments, defaults to "cycle" loop type. With paths, "continue" and "offset" might not work how you would expect. They work per point / tangent.

Arguments accepted:

  • type: A string; one of "cycle", "pingpong", "continue", or "offset"
  • numKeyframes: Number of keyframes to loop, measured from the first keyframe to the numKeyframes + 1 keyframe.
  • matchNativeLoopFuncJump: Adds the "jump" which occurs in the first loop cycle of the native loopOut function. Defaults to true.

Example expression:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; createLib.loopInOutPath("offset", "pingpong");

________________________________________

useTimeBetween

useTimeBetween(timePairs)

Only use the the time at certain regions of the comp. May be used in tandem with any function that can be driven by time. The time can be defined by hardcoded values, keyframes, or layer in and out points.

For example, you could get the source rect of a Text Layer after its animation is complete to avoid box resizing issues, but still follow the layer when the Text is animating off screen.

Arguments accepted:

  • timePairs: Any even number of time values as numbers.

Example of this function used in tandem with autoScaleAtTime:

footage("CreativeExpressionLibrary-v2.1.jsx").sourceData; var timeToUse = createLib.useTimeBetween(thisLayer.inPoint, thisLayer.outPoint); createLib.autoScaleAtTime(thisComp.layer("Target Layer"), timeToUse);

Back to Top