Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions random comp positioning

  • random comp positioning

    Posted by Darren Hardaway on June 17, 2009 at 3:46 am

    I saw the tutorial by Rob Birnholz about using particular to make a photo montage, and I thought it would be kinda cool to have a script that did this:

    Took all of the layers in the comp and randomly shuffled their position on the timeline.

    Provided the user trimmed the layers (can you have it trim the layers to one frame as well?)they would have Sequence Layers keyframe assistant applied, not overlapped.

    Mostly I care about the random shuffle, so the others aren’t all that important. Thanks for any help!

    Filip Vandueren replied 16 years, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Filip Vandueren

    June 17, 2009 at 2:03 pm

    DO you mean randomly shuffle their order in the index of layers, or randomly offset their start-point ?

  • Darren Hardaway

    June 17, 2009 at 4:05 pm

    Randomly position the index of the layers. Although randomly arranging the start point of a bunch of one frame layers would be kinda cool too. 🙂

  • Dan Ebberts

    June 17, 2009 at 4:31 pm

    This should shuffle the order of the layers in the layer stack:

    var myComp = app.project.activeItem;
    if (myComp && myComp instanceof CompItem){
    var myLayers = app.project.activeItem.layers;
    var layerOrder = [];
    for (var i = 0; i < myLayers.length; i++){ layerOrder[i] = i+1; } var idx, temp; for (var i = 0; i < layerOrder.length; i++){ idx = i + Math.floor(Math.random()*(layerOrder.length - i)); temp = layerOrder[i]; layerOrder[i] = layerOrder[idx]; layerOrder[idx] = temp; } for (var i = 0; i < layerOrder.length; i++){ myComp.layers[layerOrder[i]].moveToBeginning(); } }else{ alert("No comp selected!"); } If you don' like the result, just run the script again. Dan

  • Darren Hardaway

    June 17, 2009 at 5:00 pm

    Thanks a bunch, works like a charm!

  • Filip Vandueren

    June 17, 2009 at 10:11 pm

    Here are some other scripts:

    https://aescripts.com/layer-random-shifter/

    and

    https://www.redefinery.com/ae/view.php?item=rd_KindaSorta

    this has several soprting modes amongst them is random

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy