Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Reflection using expression

  • Reflection using expression

    Posted by Dotan Stern on February 6, 2009 at 1:26 pm

    Hi i have a comp with a bouncing ball on a floor and i wanna animate
    the ball and its reflection using expression
    i know i can just render the ball and then duplicate it as a reflection
    but is it possible to that to the ball layer using expression
    so if the ball moves up in the Y position the reflection moves negative on the Y position
    i tried all kind of ways using minus but didn’t worked
    thanx

    Christian Pulfer replied 16 years, 10 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    February 6, 2009 at 4:27 pm

    You’ll probably want to use a different method to define where the floor is, but this should get you started:

    floor = thisComp.height/2;
    ballPos = thisComp.layer(“ball”).transform.position;

    y = 2*floor – ballPos[1];
    [ballPos[0],y]

    Dan

  • Dotan Stern

    February 6, 2009 at 7:09 pm

    Thnax dan
    i tried that i used the expression on the reflection layer and now it goes with the ball but the intersection is in the middle of the comp how can i use it with the floor i have?
    and i cant move both of the balls

  • Dotan Stern

    February 6, 2009 at 7:25 pm

    I kind of figure it out and fixes the problem i had with both balls in the middle that was because the anchor point was at the buttom
    anyway what i did was adding a camera and rotate around to look above the floor now it looks ok
    but thats the right way do it?
    if i have the comp this way :
    1: “ball” 3d comp
    2: “ball reflection” 3d comp
    3: floor 3d layer
    i dont wanna use a camera is it possible to do it this way? or the way i did was ok?

  • Dan Ebberts

    February 6, 2009 at 7:35 pm

    Hard to say without seeing it.

    Dan

  • Christian Pulfer

    July 14, 2009 at 5:05 pm

    -Apply this to the Reflection layers Position
    -Rename (“LayerName”) to fit the project
    -Then you must invert the “Y” value in the scale
    and apply any Masking and transparency you like.

    x=thisComp.layer(“LayerName”).transform.position[0]
    y=thisComp.layer(“LayerName”).transform.position[1]*-1
    z=thisComp.layer(“LayerName”).transform.position[2];
    [x,y,z]

    Now precomp your floor layer with all it’s lighting and other related layers and stack the two layers (top and reflection layer) above the precomp of the floor.

    You could also think about linking the transparency,
    and/or a blur effect to the “Y” value.

    Here’s another one that we created to include an adjustable horizon plane.

    hor = 600 !//-double the y value of the OG Layer
    X=thisComp.layer(“LayerName”).transform.position[0]
    Y=thisComp.layer(“LayerName”).transform.position[1]-hor
    Z=thisComp.layer(“LayerName”).transform.position[2];
    [X,-Y,Z]

    Good luck!

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