The way i would do it is this. First make a layer named “Number Control”. In the text source expression field write this
var a = new Array;
for (i = 0; i<100;i++) a[i]=i
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
shuffle(a);
"["+a.toString()+"]"
Then use this expression in each of your layer
var x= eval(comp("Comp 1").layer("prim").text.sourceText.toString());
if (time<5) x[index] else value
credits for the shuffle function https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
Andrei
My Envato portfolio.