Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions variable statement expression – sometimes rate of spin, sometimes wiggle?

  • variable statement expression – sometimes rate of spin, sometimes wiggle?

    Posted by Anna Hahn on April 22, 2021 at 8:10 pm

    Hello!

    I am trying to write an expression that has multiple states – if the audio signal is below 60, it wiggles, if the audio signal is above 60 then the wiggle behavior is overridden by a spin behavior

    I have the two separate expressions here- what is the proper syntax to combine them and make them work as described above?

    bamm= thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

    rates = (bamm> 52) ? 1800 : 150 ;

    [time*rates]

    //[time*(if(bamm> 60) 500 else 150)]

    //(Math.pow(bamm,0))

    //if(bamm> 60) 500 else 150

    temp= wiggle(7, 50);

    wiggle(3,temp)

    Dan Ebberts replied 5 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    April 23, 2021 at 11:21 pm

    It’s hard to tell exactly what you’re after here, but it can get pretty complicated if you need the wiggle to start where the last rotation ended and vice versa. Play with this and see what you think:

    bamm= thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

    rotateRate = 150;

    threshold = 60;

    f = timeToFrames(time);

    rotateFrames = 0;

    wiggleFrames = 0;

    for (i = 0; i <=f; i++){

    bamm.valueAtTime(framesToTime(i)) > threshold ? rotateFrames++ : wiggleFrames++;

    }

    tW = framesToTime(wiggleFrames);

    tR = framesToTime(rotateFrames);

    w = wiggle(7,50,1,.5,tW) - valueAtTime(tW);

    tR*rotateRate + w

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