LIMITFPS -1
LOCAL x_start =0
LOCAL x_end = 400
remake:
LOCAL tstart = GETTIMERALL()
LOCAL duration = 2000 // [ms]
WHILE TRUE
DRAWRECT x_start,0,4,100,0xffffff
DRAWRECT x_end,0,4,100,0xffffff
// find a position of the left to right movement
// in the range [0.0 ... 1.0]
LOCAL pos = (GETTIMERALL()-tstart) / duration
IF pos > 1.0 THEN BREAK // ok, reached the end
// move at linear speed
LOCAL x
x = x_start + pos * (x_end-x_start)
PRINT "Linear", x, 0
// accelerating
x = x_start + SIN(pos*90) * (x_end-x_start)
PRINT "sin", x, 30
// decelerating
x = x_start + (1.0-COS(pos*90)) * (x_end-x_start)
PRINT "cos", x, 60
// accellerating and decelerating
x = x_start - (COS(pos*180)-1)/2 * (x_end-x_start)
PRINT "sin", x, 90
SHOWSCREEN
WEND
KEYWAIT
GOTO remake