Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active June 29, 2020 17:14
Show Gist options
  • Save animoplex/c706d6df86674120e6e1e7d75c45d8ef to your computer and use it in GitHub Desktop.
Save animoplex/c706d6df86674120e6e1e7d75c45d8ef to your computer and use it in GitHub Desktop.
If / Else Statements (Numbers) - After Effects Expression by Animoplex
// If / Else Statements (Numbers) - Created by Animoplex: www.animoplex.com
// A collection of if/else statements using numbers.
// Variation A: Even Or Odd
// Determines if the input is an even or odd number, outputs based on the result.
num = effect("Slider Control")("Slider");
if ((num % 2) == 0) {
100;
} else {
0;
}
// Variation B: If A Number Is Between Two Numbers
// Useful for setting conditions for numbers within a range.
num = effect("Slider Control")("Slider");
min = 1;
max = 10;
if ((num >= min) && (num <= max)) {
100;
} else {
0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment