pec1985/TiDraggable

Animate back to start position

Opened this issue · 1 comments

Is it possible to have the view animate (elastic) to its start position? The most obvious example I guess is the new Facebook message heads animations.

** EDIT: I have just seen in the screenr that your green and red boxes do this already, but I cannot seem to replicate it? I have even copied and pasted the example code. Mine just stick to where I drop them...

Hi,

Here is how I did it…
Note the position reset workaround see my posted issue #14 for more details.

var someStartX = 10;
var someStartY = 10;
view.addEventListener('end', function(e)
{   
    //Position reset workaround….
    e.source.setLeft(e.source.left);
    e.source.setTop(e.source.top);

    var a= Ti.UI.createAnimation({top: someStartY, left: someStartX});
    e.source.animate(a);
});

Chris