Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active August 22, 2022 11:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save animoplex/d36d4fcdf936a74cc1a283a38d725e67 to your computer and use it in GitHub Desktop.
Save animoplex/d36d4fcdf936a74cc1a283a38d725e67 to your computer and use it in GitHub Desktop.
After Effects Array Methods - After Effects Expression by Animoplex
// After Effects Array Methods - Created by Animoplex: www.animoplex.com
// List of compatible array methods in After Effects expressions and what they do.
// Full Tutorial: https://www.youtube.com/watch?v=l7Xd8mkqWfc&t=268s
// Output an array as a string separated with the argument's contents.
myArray.join(", ")
// Outputs a string with elements separated by commas.
myArray.toString()
// Sort an array alphabetically or numerically.
myArray.sort()
// Removes a set of indices from an array. First argument is the start point, second argument is the number indices to remove, third argument is optional, what to insert as a replacement.
myArray.splice(1, 2, "newString")
// Returns selected indices as a new array. First argument is the start point, second argument is the ending index.
myArray.slice(1, 2)
// Reverses elements and returns the new array.
myArray.reverse()
// removes first index in array and outputs that element. Reference the array variable again to see new changes.
myArray.shift()
// adds new item to start of array and returns new length. Reference the array variable again to see new changes.
myArray.unshift("newString")
// removes last index in array and outputs that element. Reference the array variable again to see new changes.
myArray.pop()
// Adds a new item to end of array and returns new length. Reference the array variable again to see new changes.
myArray.push("newString")
// Joins two arrays together into one array.
myArray.concat(newArray)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment