Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Decaying bounce with increasing frequency ?

  • Decaying bounce with increasing frequency ?

    Posted by Daniel Crooks on June 5, 2012 at 1:05 pm

    hi all

    I’m trying to write a decaying bounce function that more closely simulates real physics than than classic decaying cosine wave. I’ve done quiet a bit of searching online and most of the maths (derivatives ?) is way over my head. I don’t need it to be a perfect simulation but I really need the frequency to increase over time.

    I’ve tried various, increasingly baroque, options and spent way too much time in Grapher but most of my solutions will only work for a limited set of variables, change the input for decay or frequency by too much and stuff starts wigging out at the end.

    any advice on how to tackle this would be greatly appreciated.

    cheers../Daniel

    below are examples of the code I’m currently working with (apologies for formatting)
    a) the simple Cosine decay, time between bounces is constant
    b) my best attempt at introducing an increasing frequency so that bounces start to speed up

    // simple exponential decaying bounce

    amp = 150;
    decay = 0.5;
    freq = .5;
    x = time;

    eDecay = Math.exp(decay*x);
    cosPos = Math.cos(Math.PI*freq*2*x);
    absPos = Math.abs(cosPos);
    decayPos = absPos/eDecay;
    posY = amp*decayPos;
    posX = 100;
    position + [posX,-posY]

    // exponential decaying bounce with increasing frequency

    amp = 150;
    decay = 0.5;
    freq = .15;
    x = time;

    eDecay = Math.exp(decay*x);
    cosPos = Math.cos(Math.PI*freq*2*x*Math.pow(1.3,x)+(2*x));
    absPos = Math.abs(cosPos);
    decayPos = absPos/eDecay;
    posY = amp*decayPos;
    posX = 100;
    position + [posX,-posY]

    Daniel Crooks replied 13 years, 11 months ago 1 Member · 2 Replies
  • 2 Replies
  • Daniel Crooks

    June 9, 2012 at 2:55 am

    anybody ?

    I’ve been banging my head against this for three days now without any joy. I’ve tried every way I can think to tie the frequency of bounces to the decay but I can’t get it stable.

    from online research most bouncing ball solutions use velocity and vector maths with variables for gravity and restitution. but this needs an environment which remembers it’s last state (not what after effects does). Is it impossible to do without the old “calculate every value up to this frame” trick…

    my head is hurting.

  • Daniel Crooks

    June 10, 2012 at 6:57 am

    for anyone who finds this thread in the future I found the answer.
    the legendary Dan Ebberts posted it 8 years ago !
    https://forums.creativecow.net/archivepost/2/421968
    now if only I could understand what is actually going on…

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