Created
February 3, 2025 22:03
-
-
Save dvschultz/eef3e0736603ed6c416bfc2dcf8d1271 to your computer and use it in GitHub Desktop.
Randomize layers in Adobe After Effects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| var myComp = app.project.activeItem; | |
| var n = myComp.numLayers; | |
| var myLayers = []; | |
| var myIdx = []; | |
| for (var i = 1; i<= n; i++){ myIdx[i-1] = i; myLayers[i-1] = myComp.layer(i); } var idx; var temp; for (var i = 0; i < myIdx.length; i++){ idx = i + Math.floor(Math.random()*(myIdx.length - i)); temp = myIdx[i]; myIdx[i] = myIdx[idx]; myIdx[idx] = temp; } for (var i = 0; i < myIdx.length; i++){ myLayers[myIdx[i]-1].moveToBeginning(); } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment