ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Random Jump Cuts based on time markers

FAQ   •   VIEW ALL Random Jump Cuts based on time markers on Aug 24, 2016 at 8:43:19 am

Hello
I'm trying to edit this expression:

segDur = .5;// duration of each "segment" of random time
minVal = inPoint;
maxVal = outPoint - segDur;

seed = Math.floor(time/segDur);
segStart = seed*segDur;
seedRandom(seed,true);
startVal = random(minVal,maxVal);
endVal = startVal + segDur;
linear(time,segStart,segStart + segDur, startVal, endVal);

To make the jump cuts start and end based on time markers, but with no luck :(
Anyone has suggestions?

```segDur = .5;// duration of each "segment" of random time minVal = inPoint; maxVal = outPoint - segDur; seed = Math.floor(time/segDur); segStart = seed*segDur; seedRandom(seed,true); startVal = random(minVal,maxVal); endVal = startVal + segDur; linear(time,segStart,segStart + segDur, startVal, endVal);``` Re: Random Jump Cuts based on time markerson Aug 24, 2016 at 4:42:38 pm

I guess it would be something like this:

``` minVal = inPoint; maxVal = outPoint; n = 0; if (marker.numKeys > 0){ n = marker.nearestKey(time).index; if (marker.key(n).time > time) n--; } if (n > 0){ t = time - marker.key(n).time; seedRandom(n,true); base = random(minVal,maxVal); base + t; }else value ```

but you'll probably want to adjust maxVal so it never runs off the end of the clip.

Dan Re: Random Jump Cuts based on time markerson Jan 29, 2020 at 6:14:14 pm

hi!
I've been trying to adapt it to make the jump go to the frame number on each marker's comment instead of random (so if the marker comment says 17, it jumps to frame 17, etc), but no luck at all
Any ideas? Thanks! Re: Random Jump Cuts based on time markerson Jan 29, 2020 at 6:56:01 pm
``` n = 0; if (marker.numKeys > 0){ n = marker.nearestKey(time).index; if (marker.key(n).time > time) n--; } if (n > 0){ time - marker.key(n).time + framesToTime(parseInt(marker.key(n).comment,10)); }else 0 ```