Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions radnom timeline marker

  • radnom timeline marker

    Posted by Dave Baum on October 22, 2009 at 1:11 pm

    Hi,

    I’m new to expressions, and having searched a bit I can’t find the answer to what I’m looking for, so I’m hoping someone may be able to help. There may be a better way to do what I’m trying to do, but I think there must be a suitable expression!

    Without going into detail about what I’m trying to achieve (I’d be happy to if it helps) I winder if there is an expression that will allow me to tell the playhead to navigate to any goven point aling the timeline, at random.

    For example, I place 64 shots sequentially along a timeline. they are of varying length. Can I add a marker or something at the beginning of each clip (if necesary) and then tell the playhead to go to shot 36, then shot 42, then shot 1, but for it to decide which point itself and randomly? SO that if this were to be duplicated, the results would not be the same, and different points on the timeline would be be selected and therefore different clips being played?

    If it helps, the plan is to get a timeline with 64bsequential clips in it, add these 64 shots to a new comp in a grid so I have 64 clips playing at once, but thanks to the expression, hopefully none at the same time. Does this make sense?!

    This is an unpaid collaboration, so I’m not trying to make a wad of cash on the back of some very clever advice, but I am trying to work in the most efficient way I can. To do this manually is scaring me!

    Many thanks in advance,

    Dave

    Dave Baum replied 16 years, 6 months ago 3 Members · 12 Replies
  • 12 Replies
  • Xinlai Ni

    October 22, 2009 at 4:27 pm

    Expression can’t achieve what you have described, a script can do it fairly well. In the script:
    1. Create a new empty comp that will contain all 64 clips.
    2. Create an integer array of 64 elements, randomly permute their indices, e.g., array[0] = 24, array[1] = 3, …, array[63]=5.
    3. Loop to create layer and set their in-points, pseudo code:
    var lastInPoint = 0;
    for (i = 0; i < 64; ++i) { // create layer using clip[array[i]] // set this layer's inPoint to lastInpoint // lastInpoint += this clip's duration // place this layer to the comp in the desired 'grid' position } The above script has the limitation that the comp will show only one clip at a time with all other clips invisible, as opposed to be showing the first/last frame. Xinlai Ni Software Engineer, Google Inc.

  • Dan Ebberts

    October 22, 2009 at 6:53 pm

    OK – this is a fun one. Once you have all your layers sequenced, precompose them. Enable time remapping for the new pre-comp layer (don’t change its name), and apply this time remapping expression:

    myComp = comp(name);
    n = myComp.numLayers;
    seedRandom(index+101,true);
    theLayers = [];
    for (i = 1; i <= n; i++) theLayers[theLayers.length] = i; for (i = 0; i < theLayers.length; i++){ idx = i + Math.floor(random(theLayers.length - i)); temp = theLayers[i]; theLayers[i] = theLayers[idx]; theLayers[idx] = temp; } accumDur = 0; for (i = 0; i < n; i++){ myLayer = myComp.layer(theLayers[i]); nextDur = myLayer.outPoint - myLayer.inPoint; if ((time >= accumDur) && (time < (accumDur + nextDur))){ break; } accumDur += nextDur } i = Math.min(1,n-1); myComp.layer(theLayers[i]).inPoint + time - accumDur Dan

  • Dave Baum

    October 23, 2009 at 11:11 am

    Guys,

    thanks a lot for your help! I’m gonna build up a dummy using solids and see if I can get the result I need, will let you know.

    Dan, thanks, am looking forward to trying this out, I think you managed to decipher what I meant from a poorly written description!

    Cheers

    Dave

  • Dave Baum

    October 23, 2009 at 11:53 am

    OK, Dan – apologies for the stupid questions here, please bare with me!

    I’ve created a dummy project of 10 seconds duration, using 10 numbered solids of different colours sequentially. with no expressions, they play through at 1 second each and serve as a guide to see what’s going on.

    With the expression added, only number 9 plays, for all of the 10 seconds of the comp.

    I’m struggling to understand what the expression is doing exactly, and I’m happy to spend time on that, but is there a detail I am missing out? Are there parameters I must specify?

    Thanks again!

    Dave

  • Dan Ebberts

    October 23, 2009 at 6:16 pm

    Did you precomp the ten solids, enable time remapping on the precomp layer and apply the expression?

    Dan

  • Dave Baum

    October 26, 2009 at 9:50 am

    Hi Dan,

    Thanks for your responses. re the test, I did do as you suggested. Process as follows:

    created a 10 second comp, added 10 sequential solids @ 1 sec each, numbered them 1-10 with corresponding text layers for reference on playback (comp contains 20 layers).

    I Pre comped this, all media transferred to the pre comp (no option for otherwise), pre comp name not changed.

    I added the expression to the precomp.

    If I duplicate the precomp, each duplication displays a different colour and number, but is holding that combination of number & solid throughout the sequence.

    If you don’t mind offering further assistance I’d be extremely grateful!

    Many thanks for your help

    Dave

    ps can upload screengrabs / project if its easier

  • Dan Ebberts

    October 26, 2009 at 1:51 pm

    It would be helpful to see the project.

    Dan

  • Dave Baum

    October 27, 2009 at 1:11 pm

    Hi again Dan. below is link to the dummy project…

    https://myaccount.dropsend.com/storage?folder_id=575787

    thanks in advance for any thoughts.

    best

    Dave

  • Dan Ebberts

    October 27, 2009 at 4:04 pm

    Hi Dave,

    That link takes me to a place where I need to log in – I’m not sure it’s correct.

    Dan

  • Dave Baum

    October 28, 2009 at 2:21 pm

    Sorry, please try this one:

    https://uploading.com/files/ec7m667e/SequenceTesting.aep.zip/

    After no joy having precomped the 20 layer test comp via layer menu (all layers move to the precomp), I dragged the test comp to the new one and added expression to that, but same issue.

    Thanks again for your help, very much appreciated!

    Dave

Page 1 of 2

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