Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random Jump Cuts based on time markers

  • Random Jump Cuts based on time markers

    Posted by Rolando Lacanna on August 24, 2016 at 8:43 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?
    Many thanks in advance

    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);

    Peter Zeet replied 6 years, 6 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    August 24, 2016 at 4:42 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

  • Rolando Lacanna

    August 24, 2016 at 8:54 pm

    That’s exactly what I was looking for!
    Thank you so much!!!

  • Peter Zeet

    January 29, 2020 at 6: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!

  • Dan Ebberts

    January 29, 2020 at 6:56 pm

    Try this:


    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

    Dan

  • Peter Zeet

    January 30, 2020 at 3:33 pm

    thanks!! what a beautiful line of code!

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