Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Elaan Dak on July 31, 2011 at 12:48 pm

    Sorry I’m asking the same question again, but I still don’t know how to do it.
    The thing is that I got the effect I want but the objects is getting outside the camera view, how can I modify the code to offset the objects go to the center, I mean toward the camera in Z axis?
    This is now:

    And I’m looking to have this result:

    And this is the AE file:

    https://www.box.net/shared/rugaib41hs3a6tjp7om9

    Thanks in advance.

    Elaan Dak replied 14 years, 9 months ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    July 31, 2011 at 5:07 pm

    Try this:


    mouse_layer = thisComp.layer("mouse layer");
    beginScale = 100;
    endScale = 1500;
    beginDistance = 40;
    endDistance = 0;

    w = thisComp.width;
    p0 = value + 30;
    camPos = [w/2,thisComp.height/2,-50/36*w];
    v = normalize(camPos-p0);
    dis = length(position, mouse_layer.position);
    val = ease(dis, beginDistance, endDistance, endScale, beginScale);
    p0 + v*val

    If you had a camera in the comp, you would use its position instead of the calculated position.

    I wasn’t sure what the +30 is for, but I stuck it in there.

    Dan

  • Elaan Dak

    August 1, 2011 at 7:45 am

    Thank you Dan, its working nice.

    One more thing is that all the objects are following the same Z distance, it should be also calculated according to where that object X position is (close or far from the camera), So the object on the very left and the very right should move a longer Z than the one in the center.

    I tried to add this.x to each object’s (endScale) but I ended with that the very right crosses the most distance.

    Thanks again.

  • Dan Ebberts

    August 1, 2011 at 1:31 pm

    I don’t have time to test it, but try this:

    mouse_layer = thisComp.layer("mouse layer");
    beginScale = 100;
    endScale = 1500;
    beginDistance = 40;
    endDistance = 0;
    w = thisComp.width;
    p0 = value + 30;
    camPos = [w/2,thisComp.height/2,-50/36*w];
    m = length(camPos,p0)/camPos[2];
    v = normalize(camPos-p0);
    dis = length(position, mouse_layer.position);
    val = ease(dis, beginDistance, endDistance, endScale*m, beginScale);
    p0 + v*val

    Dan

  • Elaan Dak

    August 7, 2011 at 1:54 pm

    Thanks guys, you are amazing..

    Everything is fine unless that is goes in the opposite way not toward the camera as it was before..

    What value I should add a (-) to?

    This is the current code:

    mouse_layer = thisComp.layer("mouse layer");

    beginScale = 0;
    endScale = 2100;
    beginDistance = 600;
    endDistance = 0;

    w = thisComp.width;
    p0 = value + 30;
    camPos = [1440,540,-2240];
    m = length(camPos,p0)/camPos[2];
    v = normalize(camPos-p0);
    dis = length(position, mouse_layer.position);
    val = ease(dis, beginDistance, endDistance, endScale*m, beginScale);
    p0 + v*val

    Thanks Dan..

  • Elaan Dak

    August 7, 2011 at 10:17 pm

    I tried on the camera, and the Z but still not.

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