FORUMS: list search recent posts

# Decaying bounce with increasing frequency ?

FAQ   •   VIEW ALL
 Decaying bounce with increasing frequency ? on Jun 5, 2012 at 1:05:37 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]```

 Re: Decaying bounce with increasing frequency ?on Jun 9, 2012 at 2:55:37 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...