Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Damping a rapidly changing value

  • Damping a rapidly changing value

    Posted by Paul Roper on March 11, 2013 at 1:57 pm

    Hello,

    I’m looking for a way to damp the decay of a rapidly changing value. Specifically, I have a particle system generating explosive bursts, and I have linked the birth rate to the intensity of a light to illuminate my scene. The particle birth rate has a modified wiggle expression to randomise the bursts. But my problem is that as soon as the birth rate drops back to 0, the light goes off, but I’d like it to fade off as the particles fly past it for a second or so.

    I’ve taken a look through a few of Dan Ebberts’ motionscripts, and found some nice decay expressions using Math.exp, but I don’t really know how to trigger this slow decay whenever a large, rapid value increase-then-decrease has just occurred.

    Any thoughts, anyone?

    Thanks!

    -Paul

    Mitch Mann replied 13 years, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Camp

    March 11, 2013 at 7:59 pm

    you could try smooth()…

    try something like this:

    br = thisComp.layer("White Solid 1").effect("CC Particle World")("Birth Rate"); //this is your particle system's birthrate
    br.smooth(.2,5);

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Paul Roper

    March 12, 2013 at 9:41 am

    Thanks for that Kevin. But, there a couple of things…
    As you can see from the screenshot, no matter what values I put into the width and samples of the smooth function, there seems to be a very strange relationship between the input value and result. As I’ve highlighted, sometimes I get a complete inverse of the value.

    Also, if I perform any mathematical operations on the variable before the smooth function, AE generates an error (br.smooth is undefined); ie:

    br=thisComp.layer(“sparky 3”).effect(“CC Particle Systems II”)(“Birth Rate”);
    br.smooth(.1,20)

    …is fine, whereas:

    br=thisComp.layer(“sparky 3”).effect(“CC Particle Systems II”)(“Birth Rate”)*18;
    br.smooth(.1,20)

    is not. I got around it by putting the *18 on an expression slider and passed that to the smooth function instead.

    But the main issue is that I’d like to have the result spike nicely like the particle birth rate (ie. the light ‘cuts’ to full intensity) THEN fade off, rather than the smooth increase and decrease that the smooth function gives me. I think for now I’ll probably just manually keyframe it…but that’s always such a clunky way of doing things when I know I can get AE to do the work for me! But the only way I can think of doing it is by some elaborate if…then setup along the lines of:

    if (birthrate at current time) is a lot more than (birthrate 1 frame ago) then
    {
    intensity = 900%
    initiate some kind of Math.exp to fade it off
    }
    …or something along those lines.

    Yeah….manual keyframing for now I think!

    – Paul

  • Mitch Mann

    March 12, 2013 at 4:17 pm

    I’d probably do a college-dropout method, something like this:

    Get the value of the birth rate. Then get the value of the birthrate at a few places ahead in time and back in time (with valueAtTime.) Then use the highest value among these for your light. Or perhaps average all the values, depending on what you need / how it looks.

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