Hi all.
i dont know how to explain exact this
i have a big imageview on my activity
i need to make the user tilt the device and move to left,right,top etc.
for example the activity size its (0%x to 100%x) if i tilt my device to right i got (10%x to 110%x) etc...
this example by @Erel
https://www.b4x.com/android/forum/threads/orientation-and-accelerometer.6647/#content
already show the x based on accelerometer.
but how to move one imageview or activity based on accelerometer x and y?
i m tryed
This is moving the image to left and right with tilt phone but its very fast and make a bug on background like this
how can i correct move the imageview with tilt, based on %x and %y?
and how to stop this bug when i move the imageview?
thx
i dont know how to explain exact this
i have a big imageview on my activity
B4X:
imgmao.SetLeftAndRight(-50%x,150%x)
imgmao.SetTopAndBottom(-50%y,150%y)
i need to make the user tilt the device and move to left,right,top etc.
for example the activity size its (0%x to 100%x) if i tilt my device to right i got (10%x to 110%x) etc...
this example by @Erel
https://www.b4x.com/android/forum/threads/orientation-and-accelerometer.6647/#content
already show the x based on accelerometer.
but how to move one imageview or activity based on accelerometer x and y?
i m tryed
B4X:
Sub Sensor_SensorChanged (Values() As Float)
Dim ps As PhoneSensors
Dim sd As SensorData
ps = Sender
sd = SensorsMap.Get(ps)
If sd.ThreeValues Then
imgmao.Left = PerXToCurrent(NumberFormat(Values(0), 0, 3)*100)
Else
imgmao.Left = PerXToCurrent(NumberFormat(Values(0), 0, 3)*100)
End If
End Sub
This is moving the image to left and right with tilt phone but its very fast and make a bug on background like this
how can i correct move the imageview with tilt, based on %x and %y?
and how to stop this bug when i move the imageview?
thx
Last edited: