Option Explicit
Private Sub Timer1_Timer()
Const pi = 3.141592653
Dim sec As Integer
Dim x As Single
Dim y As Single
Static xOld As Single
Static yOld As Single
sec = Second(Now)
Picture1.Scale (-12, 12)-(12, -12)
x = 10 * Sin(sec * pi / 30)
y = 10 * Cos(sec * pi / 30)
Picture1.Line (0, 0)-(x, y), vbRed
'remove old line
Picture1.Line (0, 0)-(xOld, yOld), &H8000000F
xOld = x
yOld = y
End Sub
Const nRadius As Single = 10
Dim vColors As Variant
Dim n As Integer 'number of colors
Dim i As Integer
Dim startX As Single
Dim startY As Single
Dim endX As Single
Dim endY As Single
n = 3
vColors = Array(vbRed, vbGreen, vbBlue)
For i = 0 To n - 1
startX = i * nRadius / n * Sin(sec * pi / 30)
startY = i * nRadius / n * Cos(sec * pi / 30)
endX = (i + 1) * nRadius / n * Sin(sec * pi / 30)
endY = (i + 1) * nRadius / n * Cos(sec * pi / 30)
Picture1.Line (startX, startY)-(endX, endY), vColors(i)
Next
Сейчас этот форум просматривают: AhrefsBot, Google-бот и гости: 19