Yeah, that would be pretty cool. I'll be making something along those lines to aid me while I'm making that bouncy ball into an actual game. I wouldn't know how to start making it general purpose, but as a wrapper around canvas and requestAnimationFrame it is definitely doable.
Well, I doubt you could make it arbitrarily general-purpose.
I was thinking about maybe building on top of some existing framework. I think there are various existing libraries that help you create shapes and animate them; I imagine you could make something very useful by hooking onto the various methods in a library like that.