Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions adding flickering fade in characters to an existing expression

  • adding flickering fade in characters to an existing expression

    Posted by Santi Agustí on November 7, 2016 at 10:53 pm

    Hi all!
    I’m trying to figure out how to add a flicker option (while fading in) to an existing expression. Basically it’s a triggered- by -marker expression selector. It’s a mess, but it works for now:

    delay = .05;
    if(effect("random")("Checkbox")==true){
    seedRandom(textIndex,true);
    myDelay = random(delay)*30;
    }
    else myDelay = delay*textIndex;

    m = marker
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key("in").time > time) n--;
    }
    if (n > 0){
    t = time - (m.key("in").time + myDelay);
    startVal = 100;
    endVal = 0;

    if(effect("random")("Checkbox")==true){
    dur = (effect("dur")("Slider"))*15;

    }
    else dur = effect("dur")("Slider");

    dur =effect("dur")("Slider")
    if (t < dur){
    go = ease(t,0,dur,startVal,endVal)
    }else{
    amp = ((endVal - startVal)/dur)*.55;

    freq = 1.5;
    decay = 15;
    w = freq*Math.PI*2;
    go = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w;
    }
    [go,go]
    }else
    value

    So I tried unsuccessful ways to add variations of this one (from this post) adapted to my needs,

    maxDelay = .75;
    fadeTime = .5

    seedRandom(textIndex,true);
    delay = random(maxDelay);
    t = time-inPoint;
    seedRandom(textIndex,false);
    if (t < delay)
    100
    else
    random(linear(t,delay,delay+fadeTime,100,0))

    inside my expression, (adding first a checkbox called flicker to the layer), with no success (and if it seemed to work, it was working awfully bad):

    Any ideas? I feel like was close, but never got the right way to make it work u_u
    Thanks!

    Santi Agustí replied 9 years, 5 months ago 2 Members · 3 Replies
  • 3 Replies
  • Santi Agustí

    November 9, 2016 at 12:25 am

    Ook, I figured it out at last!
    it’s suuuper messy and it has a lot of redundant code, but it works! (feel free to post a better structured code)
    For this version, you will need 2 checkboxes, one called “random” and other called “flicker”, and 2 sliders: “delay” and “dur”
    and add a “in” layer marker whenever you want the type to start the stuff:

    delay =framesToTime(effect("delay")("Slider"))
    if(effect("random")("Checkbox")==true){
    seedRandom(textIndex,true);
    myDelay = random(delay/.15);
    }else {
    myDelay = delay*textIndex;
    }
    m = marker
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key("in").time > time) n--;
    }
    if (n > 0){
    t = time - (m.key("in").time + myDelay);
    startVal = 100;
    endVal = 0;
    if(effect("flicker")("Checkbox")==true){
    if(effect("random")("Checkbox")==true){
    seedRandom(textIndex,true);
    myDelay = random(delay/.15);
    seedRandom(textIndex,false);
    dur=framesToTime(effect("dur")("Slider"));
    if(t

  • Peter Zeet

    November 9, 2016 at 5:27 pm

    Hi!
    I tried to adapt a part of that code to make it flickering out instead of in, but I can`t make it stop, it gets stuck on an endless flickering,
    do you know how it would be to make it flicker but just during the “dur” number of frames and then zero transparency?

    delay =framesToTime(effect("delay")("Slider"))
    myDelay = delay*textIndex;
    m = marker
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key("out").time > time) n--;
    }
    if (n > 0){
    t = time - (m.key("out").time + myDelay);
    startVal = 0;
    endVal = 100;
    seedRandom(textIndex,true);
    myDelay = random(delay/.15);
    seedRandom(textIndex,false);
    dur=framesToTime(effect("dur")("Slider"));
    if(t<0){
    value
    }else{
    random(linear(t,myDelay,myDelay+dur,startVal,endVal))

    }
    }

    else
    {
    value
    }

  • Santi Agustí

    November 10, 2016 at 1:27 am

    mmm, once again, I’m sure there are a few more elegant solutions, but I’d add a specific time range control for that randomness,
    this works for me:

    delay =framesToTime(effect("delay")("Slider"))
    myDelay = delay*textIndex;
    m = marker
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key("out").time > time) n--;
    }
    if (n > 0){
    t = time - (m.key("out").time);
    startVal = 0;
    endVal = 100;

    seedRandom(textIndex,true);
    myDelay = random(delay/.15);
    seedRandom(textIndex,false);
    dur=framesToTime(effect("dur")("Slider"));

    ///////
    startFlicker = m.key("out").time;
    endFlicker =startFlicker+dur+myDelay;
    ///////////////////////

    if (time >framesToTime(startFlicker) && time < endFlicker){
    random(linear(t,myDelay,myDelay+dur,startVal,endVal))
    }

    else {
    ease(time,startFlicker,endFlicker+(dur/2.2),value,endVal)// you can change this for just "endVal" to have an abrupt end but this way it has a mini sort-of fade out of a couple frames
    }

    }

    else
    {
    value
    }

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