Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Make the camera wiggle start and stop multiple times

  • Make the camera wiggle start and stop multiple times

    Posted by Rafael Ribeiro on July 16, 2012 at 7:58 pm

    I’m new with this thing of expressions in After Effects.
    I’m making a composition whit lots of camera movements, and when it focuses on some object, it needs to wiggle.

    The code that I got from one of the Adobe Help pages turned out like this:

    timeToStart = 30;
    timeToStop = 34;

    if ((time > timeToStart) && (time < timeToStop)){
    wiggle(0.75,4);
    }else{
    value;
    }

    But I need the wiggle to start and stop multiple times. I did some kind of variable to work for the values of the time I wanted to start and stop,it looks like this:

    movestart=[30,36,42];
    moveend=[34,40,46];

    timeToStart = movestart;
    timeToStop = moveend;

    if ((time > timeToStart) && (time < timeToStop)){
    wiggle(0.75,4);
    }else{
    value;
    }

    But it didn’t work ( of course). Can someone give me a help on how to make the “timeToStart” and “timeToStop” capable of reading multiple values? Maybe it’s a variable thing in the end…I can also make new cameras for each object, but I think there may be a better way with expressions.

    Thanks for your time. 🙂

    Dan Ebberts replied 14 years, 1 month ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    July 16, 2012 at 8:52 pm

    This should work:


    movestart=[30,36,42];
    moveend=[34,40,46];

    for (i = 0; i < moveend.length; i++){
    if (time < moveend[i]) break;
    }

    i = Math.min(i,moveend.length-1);
    timeToStart = movestart[i];
    timeToStop = moveend[i];

    if ((time > timeToStart) && (time < timeToStop)){
    wiggle(0.75,4);
    }else{
    value;
    }

    Dan

  • Rafael Ribeiro

    July 16, 2012 at 8:58 pm

    Oh Yes!
    It works perfectly. Thanks a lot, Dan.

    Advice on anything I should read to understand those codes?

  • Dan Ebberts

    July 16, 2012 at 9:03 pm

    It’s all JavaScript arrays and loops. A good JavaScript reference would be a good thing to have.

    Dan

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