The following animation technique is broken in the current 1.5
continuous builds. Verified on iOS. http://developer.appcelerator.com/question/86311/ios---sdk-150---imageview-resets-to-center-before-animating">
Community question Attached movie showing behavior:
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title:'Window',
backgroundColor:'#fff',
backButtonName:'Back'
});
var imageView=Ti.UI.createImageView({
image:'default_app_logo.png',
zIndex:1
});
var moveImageOneSecButton=Ti.UI.createButton({
title:'Move: Duration 1 Sec',
top: 10,
width:200,
height:40,
zIndex:2
});
moveImageOneSecButton.addEventListener('click', function(){
var newX=imageView.center.x + 10;
var newY=imageView.center.y + 10;
imageView.animate({
center: {
x: newX,
y: newY
},
duration: 1000
});
imageView.center.x=newX;
imageView.center.y=newY;
});
var moveImageOneMilliButton=Ti.UI.createButton({
title:'Move: Duration 1 millisec',
top: 60,
width:200,
height:40,
zIndex:2
});
moveImageOneMilliButton.addEventListener('click', function(){
var newX=imageView.center.x + 10;
var newY=imageView.center.y + 10;
imageView.animate({
center: {
x: newX,
y: newY
},
duration: 1
});
});
var resetImageButton=Ti.UI.createButton({
title:'Reset Image',
top: 110,
width:200,
height:40,
zIndex:2
});
resetImageButton.addEventListener('click', function(){
var newX=win.center.x;
var newY=win.center.y;
imageView.animate({
center: {
x: newX,
y: newY
},
duration: 1
});
});
win.add(imageView);
win.add(moveImageOneSecButton);
win.add(moveImageOneMilliButton);
win.add(resetImageButton);
win.open();