Home JavaScript rubber band
Post
Cancel

JavaScript rubber band

This is a simple Javascript rubber band funciton that I wrote. Typically an animation function moves directly from point A to point B. This gives a very mechanical feel. I wrote a very simple rubber band funciton. This animates an object with velocity. The object can overshoot the destination and bounce back. The further you drag the farther it bounces.

#fooObject { position:relative; left:20px; width:150px; background:#FF0000; border:1px solid #CCCCCC; white-space:nowrap; padding:0.5em; cursor:move; }

Grab this and drag

init("fooObject"); Tested and seems to work in FF, IE and Safari.

This post is licensed under CC BY 4.0 by the author.