Activity › Forums › Adobe After Effects Expressions › radnom timeline marker
-
Dan Ebberts
October 28, 2009 at 2:55 pmAh – sorry. Somehow a typo crept into the next-to-last line. Try this:
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(i,n-1); myComp.layer(theLayers[i]).inPoint + time - accumDur Dan -
Dave Baum
October 28, 2009 at 3:46 pmbingo!
Thanks Dan, brilliant. I’ll keep you posted on the project and how it takes shape, as this is fundamental to it really.
I’m gonna test it on a more complex sequence as I have spotted one issue, but I’ll save it for when I have a clearer idea what the problem may be and get back to you if you don’t mind.
Thanks
Dave
Reply to this Discussion! Login or Sign Up