FORUMS: list search recent posts

# Expression. Random start-position to final-position

FAQ   •   VIEW ALL
 Expression. Random start-position to final-position on Jan 5, 2014 at 10:52:07 am

Hi, I'm having this issue with expression in After Effects, and hope someone can help me.

I have 40-50 circle set up so they make a certain shape. I would like to add an expression that tells each circle to start out in a Random position and then animate into the final position, and hold/stay there so they do not move anymore.

Any suggetions?

Nyman

 Re: Expression. Random start-position to final-positionon Jan 5, 2014 at 7:01:49 pm

You haven't said much about the timing or nature of the movement, but play around with this:

moveDur = 1;
seedRandom(index,true);
startPos = random([thisComp.width,thisComp.height]);
ease(time,inPoint,inPoint+moveDur,startPos,value)

Dan

 Re: Expression. Random start-position to final-positionon Jan 5, 2014 at 7:23:27 pm

Hi Dan,
Basically what you just made it what I'm looking for. Great job.

You are right, should have written somthing about timing or nature of the movement. But how do I control Duration and Ease?

And last one, can I add a wiggle to that expression, so the movement is more wiggly, if not, no worries.

And thank you so much. I've tried to read up on expression but need more practice.

Nyman

 Re: Expression. Random start-position to final-positionon Jan 5, 2014 at 8:20:24 pm

moveDur = 2;
wiggleAmp = 100;
wiggleFreq = 3;

seedRandom(index,true);
w = wiggle(wiggleFreq,wiggleAmp)-value;
startPos = random([thisComp.width,thisComp.height]);
ease(time,inPoint,inPoint+moveDur,startPos + w,value)

You can control the duration by adjust moveDur. With ease, your choices are ease() and linear(), unless you want to add your own easing calculation.

Dan

 Re: Expression. Random start-position to final-positionon Jan 5, 2014 at 8:25:49 pm

Actually, there are also easeIn() and easeOut().

Dan

 Re: Expression. Random start-position to final-positionon Jan 5, 2014 at 8:47:52 pm

Thank, thank you much, this is really cool and helpful.

Have a great day!

Nyman