# 3D-Stars in a Form

Email
 Submitted on: 1/1/2015 3:20:00 PM By: Mikael Rickan (from psc cd) Level: Not Given User Rating: By 15 Users Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0 Views: 933

Draws a nice 3D-Starfield in a Form (uses X,Y,Z positions) width a very short code Shades each star depending on the distance.

code:
Can't Copy and Paste this?
 ``` '************************************** ' Name: 3D-Stars in a Form ' Description:Draws a nice 3D-Starfield in a Form (uses X,Y,Z positions) width a very short code Shades each star depending on the distance. ' By: Mikael Rickan (from psc cd) ' ' Assumes:Create an Timer for the form called Timer1 ' ' Side Effects:None (maybe some flickering) '************************************** ' 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 Speed As Integer Private Sub Form_Activate() Speed = -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) + Speed 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 StarColor = 256 - Z(i) Circle (tmpX(i), tmpY(i)), 5, RGB(StarColor, StarColor, StarColor) Next i End Sub ```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)