Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Wiggling the result of an expression

  • Wiggling the result of an expression

    Posted by Matt Smith on November 29, 2007 at 12:47 am

    I have a series of photos arranged in 3D space, and I have a NULL which moves amoungst these.

    I have used an expression on a camera position to follow the NULL which looks like this:

    X = 1100 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[0] * 0.3);
    Y = 800 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[1] * 0.3);
    Z = thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.1)[2] – 600;
    [X,Y,Z];

    This works fine, but now I would like to add a wiggle to my position, I tried this:

    X = 1100 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[0] * 0.3);
    Y = 800 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[1] * 0.3);
    Z = thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.1)[2] – 600;
    [X,Y,Z];
    wiggle(0.5,40);

    But this doesn’t work, it wiggles, but no longer follows my NULL.

    I know I could wiggle my NULL but I am using that also as a reference to the focus point in depth of field, so if the NULL were to move away from the picture it would become out of focus.

    What am I missing here?

    Thanks

    Matt

    Kevin Camp replied 18 years, 5 months ago 4 Members · 5 Replies
  • 5 Replies
  • Adriano Moraes

    November 29, 2007 at 2:25 pm

    Hi Matt, I added a second NULL, put the wiggle expression on it

  • Kevin Camp

    November 29, 2007 at 9:06 pm

    i can’t test this right now (rendering), but i believe something like this should work:

    X = 1100 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[0] * 0.3);
    Y = 800 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[1] * 0.3);
    Z = thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.1)[2] – 600;
    [X,Y,Z] + wiggle(0.5,40);

    just adding the wiggle value to the original expression value…

    Kevin Camp
    Designer – KCPQ, KMYQ & KRCW

  • Adriano Moraes

    November 29, 2007 at 10:43 pm

    It works, much better solution than mine. So simple…

    Go for it Matt.

    Cheers

    ninguem

  • Darby Edelen

    November 29, 2007 at 11:19 pm

    [moldyboot] “i can’t test this right now (rendering), but i believe something like this should work:

    X = 1100 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[0] * 0.3);
    Y = 800 – (thisComp.layer(“Null 1”).transform.position.valueAtTime(time – 0.3)[1] * 0.3);
    Z = thisComp.layer(“Null 1″).transform.position.valueAtTime(time – 0.1)[2] – 600;
    [X,Y,Z] + wiggle(0.5,40);

    just adding the wiggle value to the original expression value…”

    The wiggle() function does not return the difference between the original value and the wiggled value, it only returns the wiggled value. So if the original value of the property that wiggle(.5, 40) is applied to is [360,240,0] the values that wiggle(.5, 40) will return will vary from [320, 200, -40] to [400, 280, 40]. To instead retrieve the difference from the initial value (values ranging between [-40, -40, -40] and [40, 40, 40]) you need to subtract that original value from your wiggle(0.5, 40) value:


    X = 1100 - (thisComp.layer("Null 1").transform.position.valueAtTime(time - 0.3)[0] * 0.3);
    Y = 800 - (thisComp.layer("Null 1").transform.position.valueAtTime(time - 0.3)[1] * 0.3);
    Z = thisComp.layer("Null 1").transform.position.valueAtTime(time - 0.1)[2] - 600;
    [X,Y,Z] + (wiggle(0.5,40) - value);

    Darby Edelen
    Designer
    Left Coast Digital
    Santa Cruz, CA

  • Kevin Camp

    November 30, 2007 at 6:53 pm

    excellent catch, thanks darby

    Kevin Camp
    Designer – KCPQ, KMYQ & KRCW

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