I found it better to decide how long you want the movement to be taken instead of using the sleep procedure. This is better tuned for computers with different speeds, and also tuned to move different distances. If you want it to move across the screen for 1 second, you need to move in smaller steps between the repeaters, but only 5 seconds to move around the screen.
I donβt remember exactly why, but we also added code to recolor the parent. I think we had problems displaying a ghostly image as our object moved around the screen.
Here is the code we use. It is inside a component that can switch itself on and off the screen.
procedure TMyObject.ShiftRight; var TicksStart: int64; StartLeftValue: integer; EndLeftValue: integer; NewLeftValue: integer; LeftValueDif: integer; RemainingTicks: int64; begin StartLeftValue := Self.Left; EndLeftValue := Self.Left + Self.Width; LeftValueDif := EndLeftValue - StartLeftValue; TicksStart := GetTickCount(); RemainingTicks := FadeTime;
source share