Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Expression for Blending Position

  • Expression for Blending Position

  • Mark Walczak

    October 19, 2011 at 4:37 pm

    Hi everyone!

    I’m wondering if there’s an expression that will allow me to blend between two positional inputs. For instance, in Cinema4D, there is an XPresso node called “Mix” that receives two inputs and allows the user to blend between the two. I’ve used it for “keyframable parenting” in the past, so it can be extremely handy!

    Is there anything like this for AE? If I haven’t done the best job of explaining it, please let me know and I would be more than happy to elaborate.

    Thank you!

    https://vimeo.com/explosivegraffix

  • Dan Ebberts

    October 19, 2011 at 6:09 pm

    I’m sure if this is what you’re after, but this expression would give you a position somewhere on the line between Layer 1 and Layer 2, depending on the value (0-100)of a slider on the layer with the expression.

    s = effect(“Slider Control”)(“Slider”);
    p1 = thisComp.layer(“Layer 1”).transform.position;
    p2 = thisComp.layer(“Layer 2”).transform.position;
    linear(s/100,p1,p2)

    Dan

  • Mark Walczak

    October 19, 2011 at 7:45 pm

    Dan,

    This is EXACTLY what I needed! I knew you’d come through for this one (as always)!

    Thank you so much!

    https://vimeo.com/explosivegraffix

  • Mark Walczak

    October 19, 2011 at 7:47 pm

    PS – If I wanted to go uber-crazy with this, could I put your ToComp expression in the place of p1 or p2 and simply link the target layers to the first line in the ToComp code?

    Thanks!

    c=this_comp.layer("child");
    c.to_comp(c.anchor_point)

    https://vimeo.com/explosivegraffix

  • Dan Ebberts

    October 19, 2011 at 8:10 pm

    Sure. I think I’d do it like this:

    s = effect(“Slider Control”)(“Slider”);
    L1 = thisComp.layer(“Layer 1”);
    p1 = L1.toComp(L1.anchorPoint);
    L2 = thisComp.layer(“Layer 2”);
    p2 = L2.toComp(L2.anchorPoint);
    linear(s/100,p1,p2)

    Dan

  • John Smith

    November 23, 2017 at 5:43 am

    hey Dan Can it be shape layer Path instead of position?

  • Dan Ebberts

    November 23, 2017 at 5:18 pm

    I’m guessing you might be talking about something like this, but it only works if you have CC 2018:

    s = effect(“Slider Control”)(“Slider”).value/100;
    L = thisComp.layer(“Shape Layer 1”);
    p = L.content(“Shape 1”).content(“Path 1”).path;
    L.toComp(p.pointOnPath(s,time))

    Dan

Viewing 1 - 7 of 7 posts

Log in to reply.

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