Random properties

WIP - last updated 21 April 2021

Abstract

One of the most useful things you can do with Expressions is randomizing layer properties. Some properties include transform properties (position, rotation, scale, or opacity), color, or even Time Remap. Learning to randomize properties is a good beginner exercise to raise one's comprehension of Javascript Expression. In this page, we will cover different ways to randomize properties.

Understanding Random functions

  • random()

  • random(minValue, maxValue)

  • seedRandom(seed, timeless=false)

Core skills: randomize values, arrays, color

What is a seed? A random seed (or seed state, or just seed) is a number (or vector) used to initialize a pseudorandom number generator. To put simply, different seed number yield difference sequence of random number.

Position

Wiggle

positioning

Opacity

Flickering / Strobe

Wiggle

Wiggle with flicker

Using sine function

Random pop on

Tutorial: Randomly Reveal Layers & Emojis with Expressions, NSC

Random fade on

Random Color

RGB color

From a color palette

Sequential cycling color from a palette

  1. retrieve the absolute index of a layer,

  2. add a slider that increment by a value at a set interval

  3. do the mod calculation

Random cycling color from a palette

Get num of color controls

Time Remapping / Playback

Random frame playback

Random delayed/advanced layer playback

Play one frame at a time (without 'float time')

Random still frame (Good for spriting)

  • for spriting images,

  • refer to CoMotion 2021 title sequence background

Source text & strings

Using text animators

Binary

From a specific set of characters or words

eg. Matrix katakana

Building a Randomizing rig or preset

Core skills: randomize time, Spriting, building controls, conditional randomizing with modulo operator (alternate colors)

Keep in After Effects scripting, the random function only returns a random number between 0 to 1. What this means is that you cannot do use random(20,30) to generate a random value between 20 and 30. You have to write a function for that, which you can reference here.

Randomizing with AE scripts

  1. Download Jeff Almasol's script from aescript or redefinery

  2. Install script via After Effects or putting directly into the Applications folder

  3. Modify values

  4. Select layers, and run script file

Last updated

Was this helpful?