Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Moving a image around using the Accelerometer

Can anybody tell me where i am going wrong with this. the square dosent move around the screen liked i thought.

var win = Titanium.UI.currentWindow;

var item = Titanium.UI.createView({
backgroundColor:'#336699',
top:300,
left:50,
height:50,
width:50
});
win.add(item);

Titanium.Accelerometer.addEventListener('update',function(e)
{
item.animate({center:{x:e.x,y:e.y,z:e.z}, duration:1});
});

— asked March 19th 2010 by Mark pollard
  • accelerometer
  • moving
0 Comments

1 Answer

  • I don't think the accelerometer values are coordinate values. Display the values you're getting from the accelerometer and you'll see what I mean.

    — answered March 20th 2010 by Mark Burggraf
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.