Probably. The shapers are based on the set of interpolators from this page where our rebound shape is the easeOutBounce from there. You can see from the diagram that the ball bounces three times before coming to a stop on the 4th.

You could absolutely do a bouncing ball simulation on crow though. Below is a sketch in that direction (though untested and likely some typos).

HEIGHT = 10 -- initial height
TIME = 0.2 -- half of first bounce time
ENERGY = 0.5 -- how much energy is preserved each bounce (out of 1.0)
height, bouncetime -- will change as the ball bounces

function init()
  input[1]{ mode = 'change', direction = 'rising' }
  output[1].action = bouncing_ball
end

input[1].change = function()
  reset()
  output[1]()
end

function reset()
  height = HEIGHT
  bouncetime = TIME
end

function bounce()
  height = height * ENERGY
  bouncetime = bouncetime * ENERGY
  if bouncetime < 0.002 then reset() end -- reset the ball when done bouncing
  return height
end

bouncing_ball =
loop{ to( bounce, time, 'log' ) -- bounce is a function & will be called each time around
    , to( 0, time, 'expo' )
    }
5 Likes