Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects make a layer move away from point (expression)

  • make a layer move away from point (expression)

    Posted by Erin Shelby on April 9, 2006 at 5:01 am

    Hi,

    So let’s say I have a small 10×10 solid and a null object. Over time, I would like the Solid to move at a constant rate away from the null. Is this possible? I can elaborate if reqired, but basically it should almost look like a single particle moving away from the source point of a particle engine. Is that possible?

    -echo

    Sam Moulton replied 20 years, 1 month ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 9, 2006 at 6:21 am

    You might start with something like this:

    angle = 45; // angle of travel away from null
    spd = 200; // speed (pixels per second)

    rads = degreesToRadians(angle);
    xComponent = Math.cos(rads);
    yComponent = Math.sin(rads);
    thisComp.layer(“Null 1”).position + [xComponent,yComponent]*spd*time;

    Dan

  • Dan Ebberts

    April 9, 2006 at 6:25 am

    If you wanted to create more of an explosion, you could use something like this and duplicate your layer a bunch of times:

    seedRandom(index,true);
    angle = random(360); // angle of travel away from null
    spd = random(150,400); // speed (pixels per second)

    rads = degreesToRadians(angle);
    xComponent = Math.cos(rads);
    yComponent = Math.sin(rads);
    thisComp.layer(“Null 1”).position + [xComponent,yComponent]*spd*time;

    Dan

  • Sam Moulton

    April 9, 2006 at 10:47 pm

    this is a really good expression that solved a problem for me. It’s in my notebook. Thanks Dan!

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