function drawLine(obj1, obj2){
var oneTop = $(obj1).position().top;
var oneLeft = $(obj1).position().left;
var twoTop = $(obj2).position().top;
var twoLeft = $(obj2).position().left;
var chaWidth = Math.abs(oneLeft-twoLeft);
var chaHeight = Math.abs(oneTop-twoTop);
var line = Math.pow(chaWidth,2)+Math.pow(chaHeight,2);
var lineLength = Math.sqrt(line);
var angle = Math.atan2(chaHeight, chaWidth)/2/Math.PI*360;
var lineDiv = $("<div></div>");
$(lineDiv).width("2px");
$(lineDiv).css({
"backgroundColor": "red",
"position": "absolute"
});
$(lineDiv).css({
"left": oneLeft,
"top": oneTop,
"-webkit-transform-origin": "top",
"-webkit-transform": "rotate(" + (-angle) + "deg)"
});
console.log($(lineDiv).css("left"));
$("body").append(lineDiv);
var timer = setInterval(function(){
i++;
$(lineDiv).height(i);
if ($(lineDiv).height() >= lineLength) {
$(lineDiv).height(lineLength);
clearInterval(timer);
}
},10);
}