Javascript animation

I’m currently working on a project which basically involves dragging the object, after which the script begins sorting the elements inside the parent DIV and when dropped, the dragged object should return to the “placeHolder’s” position.

Well everything works fine, but the last part. I’ve used both setTimeout and setInterval to try to make smooth animation, but with no luck.
In case of setTimeout, the released object moves too slow, even when the delay is set to 10ms.
In case if setInterval, the object moves at first slowly then makes “jumps” to the target. I’ve already figured out the jumps part (why it makes jumps), but still can’t make smooth animation.

Here is the code after the object is released

objT = parseInt(;
objL = parseInt(;

// in this case def1 is equal to =>
def1 = parseFloat(objT/objL);

//I'm dividing objT by objL to get the number which the script needs to move the object diagonally

function clearing() {
	if ((objT>0 && objL>0) && objT>objL) {
			objT-=def1; = objT + "px";
			objL-=1; = objL + "px";
			if (parseInt(objL) <= 0) { = 0 + "px";}
	var t1 = setInterval(function() {

           if (objT===0 || objL===0) {

So is there a way to make smooth transition using setInterval or faster method alternative to setTimeout?

If anything is unclear about the code, let me know.