Untuk prakteknya, langkahnya sebagai berikut…!
1. Pada Form1 yang sudah ada di <Proyek Grafis> anda, Pasanglah objek Picture, dan dua buah Timer seperti rancangan Gbr. 3.2 dikanan.
Dim x(100), y(100), z(100) As Integer
Dim tmpx(100), tmpy(100), tmpz(100) As Integer
Dim k As Integer
Dim zoom As Integer
Dim kecepatan As Integer
b. Objek Timer2 Prosedur Timer
Private Sub Timer2_Timer( )
If Picture1.Left > 5 Then
Picture1.Move Picture1.Left-100, Picture1.Top-10
End If
End Sub
Private Sub Form_Activate( )
BackColor = &H0&
kecepatan = -1
k = 2038
zoom = 256
Timer1.Interval = 1
For i = 0 To 100
x(i) = Int(Rnd * 1024) - 512
y(i) = Int(Rnd * 1024) - 512
z(i) = Int(Rnd * 512) - 256
Next i
End Sub
Private Sub Timer1_Timer( )
For i = 0 To 100
Circle (tmpx(i), tmpy(i)), 5, BackColor
z(i) = z(i) + kecepatan
If z(i) > 255 Then z(i) = -255
If z(i) < -255 Then z(i) = 255
tmpz(i) = z(i) + zoom
tmpx(i) = (x(i) * k / tmpz(i)) + (Form1.Width / 2)
tmpy(i) = (y(i) * k / tmpz(i)) + (Form1.Height / 2)
radius = 1
bintang = 256 - z(i)
Circle (tmpx(i), tmpy(i)), 5, RGB(bintang, bintang, bintang)
Next i
End Sub