Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position point to rotation value

  • Position point to rotation value

    Posted by Madli Man on January 2, 2013 at 2:58 pm

    Hi again,

    I found this code from mr.Dan, that calculate point position to rotation.

    Here is my situation, “OtherComp” sized 1920×1080.
    animated keyframe x 0 to another keyframe x 1920

    i would like to link this point i to ccsphere y rotation, but it cant get it rotate at last key point.
    it give only 114.6 degree. it rotate not end to end. 🙁

    Thank you.

    madliman

    x = comp("OtherComp").layer("line").effect("Write-on")("Brush Position")[0] /// X=0,Y=540
    360*x/(Math.PI*width)

    Dan Ebberts replied 13 years, 4 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    January 2, 2013 at 7:21 pm

    I think you just need to change the last line to this:

    360*x/width

    Dan

  • Madli Man

    January 3, 2013 at 12:56 am

    Thank you very much mr.Dan,

    code work for X position, but why cant we put same code to Y as height?

  • Dan Ebberts

    January 3, 2013 at 2:21 am

    For y, I guess it would be like this:

    y = comp(“OtherComp”).layer(“line”).effect(“Write-on”)(“Brush Position”)[1];
    360*y/height

    Dan

  • Madli Man

    January 3, 2013 at 2:38 am

    Dan, here is my file i would like to do.. for Y i think it work great. X rotation i tried to do so.. please guide me mr.Dan..

    5150_mappointing.aep.zip
    Thank you

  • Dan Ebberts

    January 3, 2013 at 5:08 am

    Sorry, I’m not sure what it is that you’re trying to do.

    Dan

  • Madli Man

    January 3, 2013 at 11:13 am

    anyway thank you for X rotate code Dan. 🙂

    madliman

  • Dan Ebberts

    January 3, 2013 at 4:06 pm

    I’m not sure if this is what you’re looking for, but it may help. These expressions should keep the sphere oriented so that the brush position is centered.

    // shpere’s x rotation

    y = comp(“Comp 1”).layer(“Worldmap.jpg”).effect(“Write-on”)(“Brush Position”)[1];
    (y – height/2)*180/height

    // sphere’s y rotation

    x = comp(“Comp 1”).layer(“Worldmap.jpg”).effect(“Write-on”)(“Brush Position”)[0];
    (width/2 – x)*360/width

    The key is that the span for the x rotation is only 180 degrees.

    I hope that helps.

    Dan

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