Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Elaan Dak on June 27, 2011 at 5:00 pm

    I found this expression posted by Colin Braley, and I need some help to modify it.
    Its about making an effect similar to Apple doc that magnify the icons when the mouse cursor come close.


    //Begin expression
    mouse_layer = thisComp.layer("mouse layer");//Mouse layer
    beginScale = 100;//Scale begins at this
    endScale = 250;//Scale ends at this
    beginDistance = 200;//Distance to begin magnifying in pixels
    endDistance = 0;//Distance to end magnifying in pixels
    //--Don't modify below here
    dis = length(this.position, mouse_layer.position);
    ease(dis, beginDistance, endDistance, beginScale, endScale)

    //end expression

    What I want to ask, is it possible that instead of scaling the layers, they move forward and backward toward the camera in z-axis when the mouse layer get close to them?

    Thanks in advance.

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

    June 27, 2011 at 5:59 pm

    Like this maybe:

    mouse_layer = thisComp.layer(“mouse layer”);
    beginZ = 0;
    endZ = -500;
    beginDistance = 200;
    endDistance = 0;
    dis = length(this.position, mouse_layer.position);
    z = ease(dis, beginDistance, endDistance, endZ,beginZ );
    value + [0,0,z]

    Dan

  • Elaan Dak

    June 28, 2011 at 10:11 am

    Thank for the reply, but it doesn’t work, maybe I missed some information, I attached the AE file so you guys can have a look at it.
    Basically I want the layers (1,2,3,4) to move close & far toward the camera in z-axis once the (mouse layer) move close to them.

    The file:
    https://www.box.net/shared/e8l02hr980j1aokndc9s

    Thanks in advance.

  • Dan Ebberts

    June 28, 2011 at 1:26 pm

    You make have to tweak the parameters a little, like this:

    mouse_layer = thisComp.layer(“mouse layer”);
    beginZ = 0;
    endZ = -1200;
    beginDistance = 100;
    endDistance = 0;
    dis = length(this.position, mouse_layer.position);
    z = ease(dis, beginDistance, endDistance, endZ,beginZ );
    value + [0,0,z]

    But in any case, when the layer moves in z space, it’s not going to necessarily match up with the x position of your mouse any longer, because of the camera angle.

    Dan

  • Elaan Dak

    June 28, 2011 at 2:57 pm

    Perfect..
    Its working very well.
    Thanks you very much.

  • Elaan Dak

    June 29, 2011 at 8:52 am

    Actually you are right about the camera angel, I was thinking of adding an x-position offset to the layer to move toward the center of the camera, is that possible? like
    beginX = 0; endX = mouse_layer.position + something;
    but how do you think it can happen?


    mouse_layer = thisComp.layer("mouse layer");
    beginZ = 0;
    endZ = -1200;
    beginDistance = 100;
    endDistance = 0;
    dis = length(this.position, mouse_layer.position);
    z = ease(dis, beginDistance, endDistance, endZ,beginZ );
    value + [0,0,z]

    Thanks

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