I have used the following to add a property with a "dynamic" name to an object:
var key = 'top';
$('#myElement').animate(
(function(o) { o[key]=10; return o;})({left: 20, width: 100}),
10
);
key
is the name of the new property.
The object of properties passed to animate
will be {left: 20, width: 100, top: 10}
This is just using the required []
notation as recommended by the other answers, but with fewer lines of code!