| I'd like to move an image horizontally to the middle of the screen, stop and wait x seconds and then continue moving off the screen. 
 matibee posted a nice chunk of code :
 
 
SuperStrict
Type lerpStage
	Field startTime:Float
	Field endTime:Float
	Field startPos:Float
	Field endPos:Float
	
	Function Create:lerpStage( st:Float , et:Float , sp:Float , ep:Float )
		Local ls:lerpStage = New lerpStage
		ls.startTime = st
		ls.endTime = et
		ls.startPos = sp
		ls.endPos = ep
		Return ls
	End Function
	
	Method Position:Float( time:Float )
		Local t:Float = time - startTime
		t :/ endTime - startTime
		Return startPos + t * ( endPos - startPos )
	End Method 
	
End Type 
	
Type LerpAnimator
	Field stages:TList
	Field time:Float
	Field lastMS:Float
	
	Function Create:LerpAnimator( stage:lerpStage )
		Local la:LerpAnimator = New LerpAnimator
		la.stages = New tlist
		la.stages.addlast( stage )
		Return la
	End Function
	
	Method addStage( stage:lerpStage )
		stages.Addlast( stage )
	End Method
	
	Method Update()
		time :+ 0.001 * Float(MilliSecs() - lastMS)
		lastMS = MilliSecs()
	End Method
	
	Method Position:Float()
		For Local ls:lerpStage = EachIn stages
			If ( ls.startTime <= time And ls.endTime >= time )
				Return ls.Position( time )
			End If
		Next
		Return lerpStage( stages.Last() ).endPos
	End Method
	
	Method Start()
		lastMS = MilliSecs()
		time = 0
	End method
End Type 
		
		
Graphics 800 , 600
Local animator:LerpAnimator = LerpAnimator.Create( lerpStage.Create( 0 , 1 , 800 , 300 ) )
animator.addStage( lerpStage.Create( 1, 6 , 300 , 300 ) )
animator.addStage( lerpStage.Create( 6 , 7 , 300 , - 200 ) )
animator.Start()
While Not AppTerminate()
	
	Cls
	
		DrawRect animator.Position() , 200 , 200 , 200
		DrawText animator.Position(), 0, 0
		
	Flip 1
	
	animator.Update()
	
Wend 
 
 This is similar but probably over complicated for me. Any simple examples ? Thanks.
 
 
 |