TiDraggable icon indicating copy to clipboard operation
TiDraggable copied to clipboard

Animate back to start position

Open iantearle opened this issue 12 years ago • 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...

iantearle avatar Apr 30 '13 13:04 iantearle

Hi,

Here is how I did it… Note the position reset workaround see my posted issue https://github.com/pec1985/TiDraggable/issues/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

chrisribe avatar Jan 24 '14 16:01 chrisribe