Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Object in Z space w/ Random Velocity Part 4

  • Object in Z space w/ Random Velocity Part 4

    Posted by Bryan on January 8, 2007 at 2:03 am

    There was actually a question in that last post, that might have been over looked (it’s based off of the third, z position, random velocity animation script you gave me [I’ve included it at the bottom of this post for reference])–Now, and this is the last time on this, I swear:

    How would it be scripted if I wanted the layers to start from zero z, animate in positive z, each at that random velocity, then switch at second 1.5 to come back to zero z–but, now, at zero z (which would be 3 seconds) their random velocity changes to a much, much smaller range (basically they drift ever so slightly into -z, then, say at 4 seconds or 1 second later they switch back to the original, greater, random velocity range and continue on in -z and out of frame?

    so:

    Bryan replied 19 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 8, 2007 at 3:35 am

    How about this?

    switchTime1 = 1.5;
    switchTime2 = 3.0;
    switchTime3 = 4.0;

    minV1 = 100; // min velocity (pixels per second)
    maxV1 = 500;
    minV2 = 10;
    maxV2 = 50;
    seedRandom(index,true);
    V1 = random(minV1,maxV1);
    V2 = random(minV2,maxV2)
    if (time < switchTime1){ value + [0,0,time*V1]; }else if (time < switchTime2){ value + [0,0,(2*switchTime1 - time)*V1]; }else if (time < switchTime3){ value - [0,0,(time - switchTime2)*V2]; }else{ value - [0,0,(switchTime3 - switchTime2)*V2] - [0,0,(time - switchTime3)*V1]; } Dan

  • Bryan

    January 8, 2007 at 4:28 am

    Awesome! Thanks!!!

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