How can this be wrong? Help!
Surely the code below should move a red square directly downwards by 150 pixels…?!
var win = Ti.UI.currentWindow;
var tester = Ti.UI.createView({
width:50,
height:50,
backgroundColor:'#f00',
left:0,
top:0
});
win.add(tester);
var t = Titanium.UI.create2DMatrix();
t.translate(0,150);
tester.animate({transform:t, duration:1000});
Instead it moves down and to the right…!
Can anybody shed any light on what may be going wrong?
1 Answer
-
Try to define an animation with Titanium.UI.createAnimation and pass it to the animate function instead of putting it like you are doing it now.