Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change angle of 3D rotation?

  • Change angle of 3D rotation?

    Posted by Greg Digenti on October 19, 2010 at 6:45 pm

    I’m attempting to make a lot of “comet” type particles (created with Particle Playground) orbit around a central object. I used Andrew Kramer’s expressions to attach the Producer of the particles to a Null, then used the following expression to make the Null travel in a perfect circle:

    [(thisComp.width/2), (thisComp.height/2)] + [Math.sin(time)*50, -Math.cos(time)*50]

    This seems to work just fine, except all of the comets follow the same path. Is there something I can add to the above expression in order to change the angle of rotation? I’ve tried parenting the first Null to another Null and rotating it that way, and it works fine for the flight path of the original Null, but it does nothing to the path of the particles. Apparently, the position coordinates of a parented layer don’t reflect their actual position for some reason.

    Greg Digenti replied 15 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 19, 2010 at 7:19 pm

    I’m not sure this is what you’re after, but doing it this way lets you set an offset (0 to 360 degrees) for the starting angle. It also gives you better control over the frequency and radius.

    radius = 50; // pixels
    freq = 1/6; // rotations per second
    offset = 60; // degrees

    angle = time*freq*Math.PI*2 + offset*Math.PI/180;
    center = [thisComp.width,thisComp.height]/2;
    center + [Math.sin(angle),-Math.cos(angle)]*radius;

    Dan

  • Greg Digenti

    October 19, 2010 at 9:18 pm

    Hi Dan, thanks for your help. Well, I had already made adjustments to the other script which allowed me to adjust the speed and radius of the circle (which I left out of my post because it seemed as though it would only confuse the issue), it’s just the angle of rotation that I’m having a problem with. Imagine rotating a ring shape in space, where the center always remains constant… that’s what I need to do.

    Also, Particle Playground uses three separate coordinates, so I need to have three different scripts to figure out x, y, and z. But mainly it’s the fact that it’s 3-dimensional is the reason I’m having such trouble with the expression, and it looks like your expression is 2-dimensional.

    BTW, I tried applying your script to test it, and I don’t even see the particles within the frame of the layer.

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