brick.onclick = function() {
animate({
duration: 3000,
timing: function elastic(x, timeFraction) {
return Math.pow(2, 10 * (timeFraction - 1)) * Math.cos(20 * Math.PI * x / 3 * timeFraction)
}.bind(null, 1.5),
draw: function(progress) {
brick.style.left = progress * 500 + 'px';
}
});
};