Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions i want to try some expressions for a pulsating glow

  • i want to try some expressions for a pulsating glow

    Posted by Craig Hellen on May 26, 2008 at 4:57 pm

    i have been watching maltaannons tutorials and i love everyone of them.

    But im not well versed enough in expressions so im wanting to get my feet wet with this little idea…

    I have a map with some iconography on there that i have animate in.

    I want this iconography to glow and the intensity of the glow to pulsate, im guessing the way to do this is to have a slider with an expression on it to increase and decrease smoothly (this is the expression) and then you pick whip the glow radius tool to the slider… job done?

    What sort of expression should i use on the slider? im guessing there will have to be an easing attribute added to make the glow transition smooth?

    Hope some of u superhuman expression people can help me

    Craig

    Robert King replied 17 years, 6 months ago 3 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    May 26, 2008 at 5:56 pm

    whenever you think of oscillating motion/behavior think sine or cosine functions… remember back in high school trig, sine and cosine functions when graphed look like smooth wave curves undulating between 1 and -1.

    you can use that undulating function for just about anything that you want to continuously oscillate between two values. so and expression like this could be used in the glow radius:

    f = 1;  // variable for frequency of pulse in seconds
    a = 10;  // variable for amount of glow
    (Math.cos(time * f * 2 * Math.PI) + 1) * (a / 2);

    the last line looks a bit complicated, but it’s not really… we used the Math cosine function from java (Math.cos). within that you need it to oscillate over time (time). Math.cos(time) will by itself create oscillation, but we mulitply the frequency (f) to allow the frequency to be adjusted to suit our needs. the *2*Math.PI allows the frequency to be set in seconds, it’s not necessary, but it’s nice to have a tangible measure for time. since cosine oscillates between 1 and -1 and we can’t have a negative glow, i added 1 (+1) to the cosine value to smoothly go from 2 to 0 (we could have tried an absolute function (Math.abs()) to return only positive values, but the value would not ease to zero, but kind of bounce back up from zero). then we need to multiply everyting by our amount. since our value for cosine is now 2 times as large, to keep our amount proportionate we just halved the amount (a) variable.

    if you want to learn more about expressoin, i suggest dan ebbert’s motionscript.com and jj gifford’s site on expressions

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 26, 2008 at 7:08 pm

    [Kevin Camp] “(Math.cos(time * f * 2 * Math.PI) + 1) * (a / 2);”

    i made a slight mistake on this line…. if you want the frequency to be in seconds (a value of 2 pulsates every 2 seconds) you need to invert the frequency…

    so the last line should be this:

    (Math.cos(time / f * 2 * Math.PI) + 1) * (a / 2);

    where the time is divided by the frequency. sorry for any confusion….

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Craig Hellen

    October 5, 2008 at 2:11 pm

    aww thanks for that, it really sorted me out! The expression can be used on lots of effects, very useful,

    Thanks again

  • Robert King

    October 23, 2008 at 7:13 am

    Craig, if you could just check my post about the motion I have replyed to your answers, thanks much.

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