-
After Effects Randomly selecting and showing layers in a precomp question
I was trying to research if it’s possible to randomly select layers in a precomp to appear and have them stay visible while more layers are appearing. I found this code in another thread here that’s almost what I want but then the layer switches to another one without the others staying visible.
n = 100; // number of images
minDur = 25;
maxDur = 40;seedRandom(index,true);
images = [];for(i = 0; i < n; i++){ images[i] = i; } for (i = 0; i < n; i++){ idx = i + Math.floor(random(images.length – i)); temp = images[i]; images[i] = images[idx]; images[idx] = temp; } dur = 0; f = -1; while (time >= dur*thisComp.frameDuration && f < images.length – 1){ f++; dur += Math.floor(random(minDur,maxDur+1)); } images[f]*thisComp.frameDuration
Is it possible to edit this code to get the effect I want?