Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Filip Vandueren

    March 5, 2007 at 9:28 pm

    I would precompose and sequence the frown and smile, then add a similar expression to time remapping that toggles between frame 0 and 1.

    Another approach could be two layers with inverted expressions for opacity, one is visible when the other ones not.

  • Quentin Block

    March 5, 2007 at 10:10 pm

    Thank you. This makes sense.
    I’m not sure how to create the expressions for opacity, or time remapping that toggles between frame 0 and 1.
    Any suggestions?
    Once I go to the pulldown menu and add an expression (on opacity for a particular layer), it just says “opacity” on the layer. I don’t know what to do after that…
    I’d like to learn how to create some of these simple expressions but I don’t know the language yet…
    Can you possibly give me a sample script or pointers how to do this?
    Thanks so much!

  • Filip Vandueren

    March 5, 2007 at 10:29 pm

    Ah, now I see it’s Mylenium’s script,

    I thought you knew some basics…

    anyway, a simple way for controlling the opacity would be this:
    (this assumes it’s the layer’s own X-scale that needs to control it’s opacity)

    expression for opacity of the smile:

    xscale=scale[0];
    xthreshold=80;
    if (xscale>xthreshold) {
    100
    } else {
    0
    }

    the frown layer would be exactly the same, only swap 100 and 0.

    I think this expression kind of speaks for it self, one thing to note is this:
    scale is an array with 2 or 3values (for x, y and possibly z) the first element in an array is called element 0 (that’s computer logic for you)
    so scale[0] means the first value of the scale-array, so that’s the x-scale

    the value of xthreshold should be set to the value at which you wan’t it to switch.

    for timeremapping you basically need the same expression, just use 1 and 0, but mind you 1=1 second, so put the smile at 1 second, and the frown at the start of the precomp.
    I would use the timeremapping: it uses fewer layers.

    BTW: the same thing can be written in 1 line:

    scale[0]>80 ? 100 : 0;

    this means exactly the same:

    is scale[0] bigger than 80 ? QUESTION MARK

    result=100

    else: COLON

    result=0;

    so “A?B:C” is short for “if(A) { B } else {C }”

    and if you need another layer’s scale to control the opacity, you’ll need something like:

    thisComp.layer(“Audio Amplitude”).scale[0]

    the pickwhip comes in very handy to ‘pick up’ references like those, you can find more info about that in the manual.

  • Quentin Block

    March 6, 2007 at 7:40 pm

    Filip,
    Thanks very much for your explanation and your time.
    I wll try out all of this.
    Cheers!

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