While 0=0
mseX = GraphicsWindow.MouseX
mseY = GraphicsWindow.MouseY
If mouseDown Then
For i = 1 To 4
If mseX >= Shapes.GetLeft(p[i]) And mseX <= Shapes.GetLeft(p[i]) + radius *2 Then
If mseY >= Shapes.GetTop(p[i]) And mseY <= Shapes.GetTop(p[i]) + radius *2 Then
select = i
EndIf
EndIf
EndFor
mouseDown = "False"
EndIf
If select <> "" And Mouse.IsLeftButtonDown Then
Shapes.Move(p[select], mseX - radius, mseY - radius)
ElseIf mouseUp Then
_x[select] = Shapes.GetLeft(p[select]) + radius
_y[select] = Shapes.GetTop(p[select]) + radius
GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height)
For i = 1 To 3
GraphicsWindow.DrawLine(_x[i] _y[i] _x[i+1] _y[i+1])
EndFor
select = ""
AnimateBrezier()
mouseUp = "False"
mouseDown = "False"
EndIf
Program.Delay(15)
EndWhile
Sub OnMouseDown
mouseDown = "True"
EndSub
Sub OnMouseUp
mouseUp = "True"
EndSub
Sub AnimateBrezier
x = _x[1]
y = _y[1]
For i = 0 To 1 Step t
iT_3 = Math.Power((1 - i), 3)
iT_2 = Math.Power((1 - i), 2)
t_2 = Math.Power(i, 2)
t_3 = Math.Power(i, 3)