Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Change Specific Position to Random Motion

  • Change Specific Position to Random Motion

    Posted by Neil Floyd on September 14, 2012 at 11:57 am

    Hi there, I have an expression that works fine but I want it to do the opposite. I have an image that I want to randomly move across the screen and then end at 232,100. I have it at one speed for 3 seconds and then I want it to speed up for the rest of the comp. So I duplicated the layer and changed the speed but I want the startPos to be the same as the finalPos on the other layer. Anyone be able to help me with this. I know it’s something simple I’m just missing.

    Or if someone knows how I could make it start at 232, 100 then be random and end at 232, 100 after 30seconds. Thanks in advance

    finalPos = [232,100];
    maxTime = 3;
    transitionTime = 0;

    segDur = 2;// duration of each “segment” of random motion
    minVal = [0.1*thisComp.width, 0.1*thisComp.height];
    maxVal = [0.9*thisComp.width, 0.9*thisComp.height];

    t = Math.min(time, maxTime);
    seed = Math.floor(t/segDur);
    segStart = seed*segDur;
    seedRandom(seed,true);
    startVal = random(minVal,maxVal);
    seedRandom(seed+1,true);
    endVal = random(minVal,maxVal);
    randPos = ease(t,segStart,segStart + segDur, startVal, endVal);

    ease(time,maxTime,maxTime + transitionTime,randPos,finalPos)

    Neil Floyd replied 14 years ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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