Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Wildcard characters in expression

  • Wildcard characters in expression

    Posted by Beth Kaufer on April 9, 2015 at 4:44 pm

    I am hoping someone has a solution to this?

    I am using if else statements to offset pre comps in a main comp. This works great. But I want to offset the comps different for the x and y values. I am using the layer index as my initial value.

    For the y value I have it working and have my comps set into rows. This worked fine. Now I would like my x to change with every 10th comp. So all layer index ending in 1 would have the same value; everything ending in 2 would have another value etc…

    Is there a wild card character that can be used in expressions?

    layNum = thisLayer.index;
    /*if else to determine x offset starting over every 10 images*/
    if (layNum ==*1) {xlayOff = 1}
    else if (layNum == *2 ) {xlayOff = 2}
    /*if else to determine y offset every 10 images*/
    if (layNum <=10) {ylayOff = 0}
    else if (layNum >=11 && layNum <=20) {ylayOff = 1}
    else if (layNum >=21 && layNum <=30) {ylayOff = 2}
    else if (layNum >=31 && layNum <=40) {ylayOff = 3}
    else if (layNum >=41 && layNum <=50) {ylayOff = 4}
    else if (layNum >=51 && layNum <=60) {ylayOff = 5}
    xOff= thisComp.layer("expression controls").effect("x offset")("Slider");
    yOff =thisComp.layer("expression controls").effect("y offset")("Slider");
    xNew = xOff*xlayOff;
    yNew = yOff*ylayOff;
    position = [xNew,yNew]

    -BK

    Dan Ebberts replied 11 years, 5 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 9, 2015 at 5:38 pm

    I would do a grid layout like this:

    xOff= thisComp.layer(“expression controls”).effect(“x offset”)(“Slider”);
    yOff =thisComp.layer(“expression controls”).effect(“y offset”)(“Slider”);
    origin = [width,height]/2;
    yIdx = (index-1)%10;
    xIdx = Math.floor((index-1)/10);
    origin + [xIdx*xOff,yIdx*yOff]

    You’ll probably need to adjust the value of ‘origin’.

    Dan

  • Beth Kaufer

    April 9, 2015 at 6:28 pm

    Thanks Dan. That is what I am trying to do.
    for future reference is there a wild card character that can be used?

    -BK

  • Dan Ebberts

    April 9, 2015 at 6:33 pm

    Short answer: no.

    Dan

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