Utilities

Template

// template
var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers;
var ctrl //= myComp.selectedLayers[0];
////////////////////////////////////////////////////////////////////

Generating random numbers

Max

function getRandNum(max) {
    var x = Math.floor(Math.random() * max);
    return x;
};

range

function getRandRange(min, max) {
    return Math.random() * (max - min) + min;
}

Random element from array

Generating combinations with non-repeating elements

  • Will break if caught in infinite loop⚠️

Trim string

Measuring distance between 2 points

Removing duplicates in array

The arrayCompress function is very original, but I am skeptical about its performance on large arrays.

Also, there is two important issues to mention:

1) the original array is not preserved, because array.sort() reorders its own elements -- we can fix this using array.concat().sort().

2) the function does not work if any of the supplied strings already contains "\r".— Marc Autret

Hash-sieving

Creating

Null

Slider

effect

Check

If layer exist

If effect exist in layer

Last updated

Was this helpful?