Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Swing Expression on Text

  • Dan Ebberts

    December 1, 2023 at 5:34 pm

    Play around with this:

    freq = 1.5;
    decay = 0.8;
    duration = 0.10;
    maxDelay = 1;
    r = random(maxDelay);
    t = time - (inPoint + r);
    startVal = [100,100,100];endVal = [0,0,0];
    if (t < duration){
    amp = (endVal - startVal)/duration;
    w = freq*Math.PI*2.5;
    endVal + amp*(Math.sin((t-duration)*w)/Math.exp(decay*(t-duration))/w);
  • George Beridze

    December 1, 2023 at 7:41 pm

    Yes!!! Thank you so much, works like a charm! 🙂

    May I ask you another question?

    In the code that I posted, swing animation happens from first letter of the text, and I’m wondering how to go about making the animation to start from the last letter of the text?

  • Dan Ebberts

    December 1, 2023 at 8:03 pm

    Try changing this line:

    r = textIndex*thisComp.frameDuration*0.7;

    to this:

    r = (textTotal - textIndex)*thisComp.frameDuration*0.7;
  • George Beridze

    December 1, 2023 at 8:47 pm

    You’re an absolute legend!

    Thank you. x

  • George Beridze

    December 1, 2023 at 9:19 pm

    Hey Dan, one last question..

    I’ve been playing around with the seedRandom function and can’t get my head around on how to change the seed of the random. Meaning – how can I change the randomness of it?

  • Dan Ebberts

    December 1, 2023 at 9:38 pm

    Replace this line:


    with this:

    seed = 17;

    Then you just change the seed variable (or tie it to a slider, maybe) to change the randomness.

  • George Beridze

    December 1, 2023 at 9:53 pm

    Bless you!

  • Brie Clayton

    December 2, 2023 at 11:45 pm

    Thank you, Dan!

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