Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression correction

  • Expression correction

    Posted by Vivien Lemaignan on January 15, 2018 at 4:02 pm

    Hi guys,

    I need your help on this expression,
    I put two keyframe in opacity (0 and 100)
    I have always the same message “error at line 6.. Expected ☺ :
    Thanks a lot

    Vivien

    //–Flicker On
    //Make something flicker to 100% opacity instead of fading in
    //Adjust this flicker frequency to your taste
    flickerFrequency = 50;
    // Only run expression while fading on/off.
    if (value 0) {
    opacityValue = value;
    } else {
    opacityValue = 0;
    }
    } else {
    opacityValue = value;
    }
    opacityValue;
    //–end Flicker On

    Vivien Lemaignan replied 8 years, 3 months ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    January 15, 2018 at 5:25 pm

    I don’t think that expression will actually do anything. What are you trying to do exactly?

    Dan

  • Vivien Lemaignan

    January 15, 2018 at 6:16 pm

    Thanks Dan to you answer,
    I just want to have a progressive flickering between two keyframe 0 to 100 opacity for a progressive apparition.
    Below this expression is running but the opacity value is just 0 or 100.

    Thanks for your help Dan

    Vivien

    //--Flicker On
    //Make something flicker to 100% opacity instead of fading in
    //Adjust this flicker frequency to your taste
    flickerFrequency = 150;
    op = value;
    if(op > 0 && op < 100){
    reverseAmt=100-transform.opacity;
    wiggledAmt=wiggle(flickerFrequency,reverseAmt);
    roundedAmt=Math.round((wiggledAmt/100));
    roundedAmt*100;
    }
    //--end Flicker On

  • Dan Ebberts

    January 15, 2018 at 6:30 pm

    I don’t understand the “between two keyframes” part. Do the keyframes define the duration of the flicker? I’m having trouble picturing what this should look like.

    Dan

  • Vivien Lemaignan

    January 16, 2018 at 10:26 am

    Sorry for my unclearness..
    Yes the keyframe define the duration
    I have 2 keyframe, the first at 0 % of opacity and the second at 100 %, one second later.
    For the moment with my expression the flickering is only binary (0 or 100), i want progressive random flickering that is to say : (0, 20, 5, 80, 35, 40…. 100)
    Is it clearer for you?
    Thanks Dan
    Vivien

  • Dan Ebberts

    January 16, 2018 at 5:07 pm

    Maybe something like this:


    t1 = key(1).time;
    t2 = key(2).time;
    if (time > t1 && time < t2){
    random(value);
    }else{
    value
    }

    Dan

  • Vivien Lemaignan

    January 16, 2018 at 5:55 pm

    Thanks Dan
    It’s almost perfect ☺
    Is it possible to change the intensity of flickering with a slider or a value (time per second)?
    Thanks a lot Dan

    Vivien

  • Dan Ebberts

    January 16, 2018 at 6:31 pm

    You could do something like this to get it to change every 2 frames, for example:


    f = 2; // change every 2 frames
    t1 = key(1).time;
    t2 = key(2).time;
    if (time > t1 && time < t2){
    seed = Math.floor(timeToFrames(time-t1)/f);
    seedRandom(seed,true);
    random(value);
    }else{
    value
    }

    Dan

  • Vivien Lemaignan

    January 23, 2018 at 4:46 pm

    Thanks a lot Dan you are the best, it’s perfect!
    All best
    Vivien

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