Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions One Second Fade after Event at a certain Time…

  • One Second Fade after Event at a certain Time…

    Posted by Andy Kreutzberg on February 22, 2013 at 4:38 pm

    Hi guys,

    now this might sound simple but for some reasons i can’t get my head around it.

    Here is the problem:

    I have a null object moving at a certain speed. Once it stops, a particle system linked to this speed of the null is emiting a wave of particles. The amount of particles needs to fade from 50 to 0 over the course of 1 second after the null objects speed has dropped to 0. Here is what i have so far:

    particles_controller is the name of the null object and this expression sits on the birth rate property of a cc particle world

    s=thisComp.layer(“particles_controller”).transform.position.speed;
    t1=thisComp.layer(“particles_controller”).transform.position.nearestKey(time).time
    b=value;

    if (s>0)
    {b=0};
    else
    {b}

    i have tried lots of things to get it from fading to 50 to 0 within a second after the null’s speed hits 0. The main issue is that the action must be repeatable. So if the null starts moving again, and stops, the 50 to 0 fade should repeat itself. Think of it like a stone that hits the ground and sets off a dust cloud slowly fading away, gets lifted up, falls down again, creates another dust cloud slowly fading away an so on.

    Kevin Camp replied 13 years, 2 months ago 2 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    February 22, 2013 at 5:45 pm

    i think would do it:

    target = thisComp.layer("particles_controller");
    if (target.position.speed == 0){
    n = target.position.nearestKey(time).index;
    if (target.position.key(n).time > time) n--;
    tStop = target.position.key(n).time;
    linear(time,tStop,tStop+1,value,0);
    }else{
    value;
    }

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Andy Kreutzberg

    February 22, 2013 at 7:09 pm

    Thanks Kevin. It could be pretty close. Here is what happens when your expression is part of the birth rate:

    The null moves downward from 0 to 3 seconds. During this time, the value for the particles is 50 but it should really be 0 during this action of the null. When it stops its downward movement at 3 seconds, the birth rate fades from 50 to 0 over the following second. So basically the range from 0 to 3 seconds (between the first two keyframes) should be 0 before going to 50 at the 3 second mark (keyframe 2) and then fading away to 0.

    However, from second 5 to 6 the null is moving upwards again and then from second 6 to second 7 downwards to a stop. During this movement, the birth rate remains 50 and after the keyframe at the 7th second, the birth rate fades to 0. I might be able to adjust it though, it really is almost there. It just needs to be 0 while the movements happen.

  • Andy Kreutzberg

    February 22, 2013 at 7:41 pm

    Now i just did the following test:

    i changed the first line of your expression to:

    if (target.position.speed > 0){

    I noticed when the null is just staying still, the value remains 50 until it reaches the last keyframe before the movement kicks back in while it really should just fade from 50 to 0.

    I also noticed that when i put a loopOut(“cycle”) on the null, the emission will stop and not continue with the null movement because the expression is looking at keyframes. Could there maybe be a solution involving valueAtTime for the speed of the null?

  • Kevin Camp

    February 22, 2013 at 7:43 pm

    sorry, i misunderstood. try changing the linear() function to this:

    linear(time,tStop,tStop+1,50,value);

    and set the value for the birthrate to 0.

    now it should stay at 0 until the null stops. then it jumps to 50 and decreases to 0 over one second.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    February 22, 2013 at 8:46 pm

    this should do it even with a loopOut() expression on the position of the null:

    target = thisComp.layer("particles_controller");
    if (target.position.speed == 0){
    loopDur = target.position.key(target.position.numKeys).time;
    n = target.position.nearestKey(time%loopDur).index;
    if (target.position.key(n).time > time%loopDur) n--;
    tStop = target.position.key(n).time;
    linear(time%loopDur,tStop,tStop+1,50,value);
    }else{
    0;
    }

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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