Hi there,
I have this codes to enlarge an image and move it from original center to the window's center. It works on SDK 1.8 before. But after transition to SDK2.0, I have no idea why it doesn't work anymore. The scaling part work, but the center of the view doesn't move.
var shelf = Ti.UI.createView({ backgroundColor:'yellow', height:Ti.UI.FILL, width:Ti.UI.FILL, top:0, left:0, }); //--- The view need to be moved var selectedImage = Ti.UI.createView({ backgroundColor:'green', width: 100, height: 100, left: 0, top: 0 }); selectedImage.addEventListener('click', function(e){ selectedImage.animate(a); }); shelf.add(selectedImage); Ti.UI.currentWindow.add(shelf); //----Animation var t = Titanium.UI.iOS.create3DMatrix(); t = t.scale(4); var a = Titanium.UI.createAnimation({ transform:t, center: {x:400, y:400}, duration: 500 });
I am testing on iPad Simulator. Anyone, any clue?
Thanks a lot in advance.
2 Answers
Not sure but try to make the view setting the center instead of the left/top. Maybe this is the issue - center undefined
Anyway looks like a bug to me.
Hello Bowie,
Try this way, it's work fine for me...
var win = Ti.UI.currentWindow; var shelf = Ti.UI.createView({ backgroundColor : 'yellow', height : Ti.UI.FILL, width : Ti.UI.FILL, top : 0, left : 0, }); //--- The view need to be moved var selectedImage = Ti.UI.createView({ backgroundColor : 'green', width : 100, height : 100, left : 0, top : 0 }); selectedImage.addEventListener('click', function(e) { selectedImage.animate(a); }); shelf.add(selectedImage); win.add(shelf); var a = Ti.UI.createAnimation(); a.top = 150; a.left = 110; a.duration = 5000;
Your Answer
Think you can help? Login to answer this question!