Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions making opacity binary (on or off) with expression

  • making opacity binary (on or off) with expression

    Posted by Adam Browne on August 29, 2012 at 8:29 pm

    I’m trying to make an effect controlled by music, and I need to make a layer’s opacity controlled by the Audio Amplitude keyframes I converted from the audio. I think I’m 80% there with this expression on the opacity of the layer:

    transform.opacity=(thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”))

    That’s varying the opacity, but what I need is for the layer’s opacity to be binary, either 0% or 100% depending on the “audio amplitude”. In other words, I want to be able to say, “if the amplitude is greater than X, be ON, if not, be OFF” Does that make sense? Any ideas?

    transform.opacity=(thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"))

    Adam Browne replied 13 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Anna Blume

    August 30, 2012 at 8:54 am

    Hi Adam,

    I’m also a beginner, but try the expression attached. If you connect the variable maxVal with an additional slider you can also change this value over time.

    maxVal = 80;
    if (thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider") >= maxVal) {
    100}
    else {
    0}

  • Adam Browne

    August 30, 2012 at 5:38 pm

    That did it! Thanks! This is my first foray into expressions… so much more to learn.

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