Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Tom Andersson on September 11, 2012 at 6:34 pm

    So…I suddenly got stuck! 🙁

    All I needed was the most simple expression to make the opacity of a layer pulsate smoothly over a given time in a sinus-like-way.

    It seems so simple, but I`m not man enough to figure it out.
    Anyone?

    /tom

    Christoph Heimer replied 9 years, 10 months ago 5 Members · 6 Replies
  • 6 Replies
  • Darby Edelen

    September 11, 2012 at 7:25 pm

    f=1;
    s=Math.sin (f * time * Math.PI * 2);

    The above will give you values ranging from -1 to 1 ‘f’ times per second. If you want to remap the output then I recommend the linear() function:

    linear (s, -1, 1, 0, 100);

    The 2nd and 3rd arguments (-1 and 1) are the input range and the 4th and 5th (0 and 100) are the output range that ‘s’ is remapped to linearly. Try changing these numbers around to clip the pulse in interesting ways.

    Darby Edelen

  • Dan Ebberts

    September 11, 2012 at 7:25 pm

    Like this maybe:

    freq = 1;
    50*(1 + Math.cos(time*freq*Math.PI*2))

    Dan

  • Tom Andersson

    September 11, 2012 at 11:17 pm

    Thanks a bunch!!!
    Works like a charm.

  • Nathan Soliz

    December 10, 2013 at 5:57 pm

    Works wonders, glad this was here.

  • Christoph Heimer

    September 15, 2016 at 10:48 am

    Cool! How can I adjust the expression so that it pulsates from 100 to 50 in value, instead of 100 to 0 ?

  • Christoph Heimer

    September 15, 2016 at 10:50 am

    figured it out, thanks!

    freq = 1;
    50*(2 + Math.cos(time*freq*Math.PI*1))

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