-
Notifications
You must be signed in to change notification settings - Fork 0
/
Runner.vb
51 lines (34 loc) · 1.16 KB
/
Runner.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Public Class Runner
Implements Animateable
Public Property line As Line
Public Property duration As Double 'in ms
Public Property Tag As Object
Public sw As new Stopwatch
Dim t As Double = 0
Public Event Finished(sender as Runner)
Sub calc (time As Double ) Implements Calculateable.calc
't = sw.ElapsedMilliseconds / duration
t = sw.ElapsedMilliseconds / Math.Max ( line.length , 1 )
If t > 1
sw.Reset
t= 1
RaiseEvent Finished (Me)
End If
End Sub
Sub paint (g As Graphics ) Implements Drawable.draw
If line is Nothing then Return
Dim p As Drawing.Point = line.getPoint (t)
g.FillEllipse (Brushes.BlanchedAlmond ,New Rectangle(p.X -16 , p.Y - 16 ,32,32 ))
End Sub
#Region "Positionable Implementaion"
Event detatch (client As Positionable ) Implements Positionable.detatch
Public Property Offset As Drawing.Point Implements Positionable.Offset
Public Property Pos As Drawing.Point Implements Animateable.Pos
Get
Return line.getPoint (t)
End Get
Set(value As Drawing.Point )
End Set
End Property
#End Region '#Region "Positionable Implementaion"
End Class