OK, so I am trying to move an image across a panel according to set coordinates I have stored in a list. I am able to get it to move exactly how I want but I can only see the ball move to the finished coordinate. If I iterate through it in debug mode I can see the ball move at each iteration. So I know everything is working but I need to slow down the movement so it looks likes its moving and not just jumping to the new coordinates.
I have tried to use a busy loop so that I can slow it down by an interval I set. but it just pauses the whole app until all iterations are done then moves the image at the end.
Here is the code I am using:
For the life of me I cant figure out why its doing this. It should be iterating through the loop getting coordinates, pausing then moving the ball then iterating again. But instead it is starting iteration getting coordinates, pausing, finishing all iterations, moving to final coordinates then un pausing. The more coordinates you have them longer it pauses until it releases the app back to you. Any help would be appreciated. Thanks
I have tried to use a busy loop so that I can slow it down by an interval I set. but it just pauses the whole app until all iterations are done then moves the image at the end.
Here is the code I am using:
B4X:
Sub cuemove_Click
Dim cuelistnum As Int :cuelistnum=0
For cuelistnum = 0 To cuelist.Size - 1 'sets a for next loop to size of list
Dim s, xcoordinates, ycoordinates As String 'sets variables needed
s = cuelist.Get(cuelistnum) 'gets the full x and y coordinates
xcoordinates = Regex.Split(" ",s)(0) 'extrapolates the x coordinates
ycoordinates = Regex.Split(" ",s)(1) 'extrapolates the y coordinates
slowdowncue(100) 'pauses animation for x amount of seconds
cueball_float.Move(xcoordinates,ycoordinates,True) 'moves to coordinates
cuelistnum=cuelistnum+1 'adds one to number for next iteration
Next
End Sub
Sub slowdowncue(time As Int)
Dim timenow As Long
timenow = DateTime.Now 'set timenow to present time
Do While DateTime.Now < timenow + time 'checks to see if ready
Loop
End Sub
For the life of me I cant figure out why its doing this. It should be iterating through the loop getting coordinates, pausing then moving the ball then iterating again. But instead it is starting iteration getting coordinates, pausing, finishing all iterations, moving to final coordinates then un pausing. The more coordinates you have them longer it pauses until it releases the app back to you. Any help would be appreciated. Thanks