Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions slider control wiggle with childComp and ParentComp

  • slider control wiggle with childComp and ParentComp

    Posted by Johan Nordström on October 10, 2012 at 1:45 pm

    Hi!

    im trying to control a wiggle in my ChildComp from my ParentComp.

    this is my expression on the scale property on a layer in my ChildComp:
    a=wiggle(comp("ParentComp").layer("SliderControl").effect("Wiggle")("Slider"),100);
    [value[0],a[1]]

    when im changing the value of my slider in ParentComp its working but as soon as i try to key frame from say 0 to 50 it does nothing, it seems to be taking the value from my first keyframe but ignoring my second key frame.

    What am i doing wrong?

    Johan Nordström replied 13 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 10, 2012 at 3:48 pm

    Did you move the ChildComp layer in the ParentComp timeline so that it doesn’t start at time=0? If so, you need to compensate for that in your expression, like this:

    C = comp(“ParentComp”);
    ctrl = C.layer(“SliderControl”).effect(“Wiggle”)(“Slider”);
    L = C.layer(thisComp.name);
    a=wiggle(ctrl.valueAtTime(time+L.startTime),100);
    [value[0],a[1]]

    However, it looks like you’re animating wiggle frequency, which is not likely to turn out the way you want. If you run into unsatisfactory results, you should read what I have here:

    https://www.motionscript.com/articles/speed-control.html#wiggle

    Dan

  • Johan Nordström

    October 11, 2012 at 8:09 am

    Thanks Dan,

    Yes im animationg wiggle freq, and im getting some weird behaviors.
    And im having some problems understanding the code on your website.
    Im not that good with code :/

    ok, iv tried alot of different ways, but i dont really know what im doing 😛 so please dont laugh 🙂
    this is what iv been trying to do:
    C = comp("ParentComp");
    freq = C.layer("SliderControl").effect("Wiggle")("Slider");
    L = C.layer(thisComp.name);
    amp = 10;
    n = freq.numKeys;
    if (n > 0 && freq.key(1).time < time){
    accum = freq.key(1).value*(freq.key(1).time - inPoint);
    for (i = 2; i <= n; i++){
    if (freq.key(i).time > time) break;
    k1 = freq.key(i-1);
    k2 = freq.key(i);
    accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
    }
    accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;
    }else{
    accum = freq.value*(time - inPoint);
    }
    wiggle(freq.valueAtTime(time+L.startTime),amp,1,.5,accum)

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