Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combining Expressions

  • Combining Expressions

    Posted by Joao Monteiro on September 17, 2014 at 11:11 am

    Hi,

    I’ve 600layers from illustrator (like particles).
    Have keyframed them individually (argg). – position
    Have added an expression to smooth those keyframes with a little bounce.
    Have also added a keyframe offset of 10 frames.
    Now I want each particle to wiggle as well. How can I add a simple wiggle(2,5)??

    Thanks in advance
    Joao Monteiro

    // smooth position keyframes bounce //

    amp = .6;
    freq = 2.0;
    decay = 2.0;
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }}
    if (n == 0){ t = 0;
    }else{
    t = time - key(n).time;
    }
    if (n > 0 && t < 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

    // offset frames expression //
    maxOffset = 10; // frames
    seedRandom(index,true);
    offset = framesToTime(random(maxOffset));
    valueAtTime(time-offset);

    Jan Míka replied 11 years, 3 months ago 3 Members · 6 Replies
  • 6 Replies
  • Joao Monteiro

    September 17, 2014 at 12:35 pm

    When I say Add I mean combine.

  • Dan Ebberts

    September 17, 2014 at 1:56 pm

    Towards the end of the first expression, try replacing each of the two occurrences of value with wiggle(2,5)

    Dan

  • Joao Monteiro

    September 18, 2014 at 2:46 pm

    Thanks Dan.
    It worked perfectly.
    Thank you.
    I was trying value+(wiggle(2,5))
    which wasn’t working.
    J

  • Jan Míka

    January 30, 2015 at 7:31 pm

    Hi Dan… I’ve got a similar problem, so that’s why I’m reading your posts actually…
    I want my Null_01 to be parented with a Null_02 in a different composition and to wiggle at the same time. I use variables for position (P) and for wiggle (W).
    All is applied in Ypos parameter:

    P = comp(“my other comp”).layer(“Null_02”).transform.yPosition;
    W = wiggle (10,10);

    How should the last line look like? I tried P+W; It works fine but the Null_01 moves to a crazy position… Any idea?
    Thank you very much!

  • Dan Ebberts

    January 30, 2015 at 9:24 pm

    Either of these should work:

    P = comp(“my other comp”).layer(“Null_02”).transform.yPosition;
    W = wiggle (10,10)-value;
    P + W

    P = comp(“my other comp”).layer(“Null_02”).transform.yPosition.wiggle(10,10);

    Dan

  • Jan Míka

    February 2, 2015 at 8:59 am

    Excellent! Thank you so much! Honza

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