by Refly (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 26th May 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Draw a circle filled with multiple random color using line.
API Declarations
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim x As Integer
Dim y As Integer
Dim xCenter As Integer
Dim yCenter As Integer
Dim angle As Integer
Timer1.Interval = 1
Timer1.Enabled = True
Me.BackColor = vbBlack
Me.Width = 3000
Me.Height = 4000
xCenter = Me.Width / 2
yCenter = Me.Width / 2
End Sub
Private Sub Timer1_Timer()
Randomize
x = xCenter + (Sin(angle) * 1000)
y = yCenter - (Cos(angle) * 1000)
red = Int(Rnd * 255)
green = Int(Rnd * 255)
blue = Int(Rnd * 255)
Line (xCenter, yCenter)-(x, y), RGB(red, green, blue)
angle = angle + 1
If angle >= 360 Then angle = 0
End Sub