Moving StarField Form BG (3D Version)
This is a really cool form effect, it looks like a starfield moving from the middle of the screen out at you, it kind of looks like the Windows screen saver. This is not originally my code, but i like it so much that i have made a better version of it. You can change the speed and color of the field. This is an update of my last submission (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=40900&lngWId=1). Enjoy
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
<p><font face="Verdana"><b><u><small><small>Moving StarField Form BG (3D Version)<br> </small></small></u><small><small>by Adam Lane</small></small><br> <br> </b><small><small>1) Create a form and a timer<br> 2) Form1 and Timer1<br> 3) Copy this code into your form</small></small></font><small><small><font face="Courier New"><small><small><br> <br> </small></small></font></small></small><font face="Courier New"><small><small><small><small>Dim X(50), Y(50), xSpeed(50), ySpeed(50) As Integer<br> <br> Private Sub Form_Load()<br> Dim i As Integer<br> Timer1.Interval = 4<br> Form1.BackColor = vbBlack<br> Form1.ForeColor = vbBlack<br> Form1.FillColor = vbBlack<br> For i = 0 To 49<br> X(i) = -1<br> Y(i) = -1<br> Next i<br> Randomize<br> Timer1.Enabled = True<br> End Sub<br> <br> Private Sub Timer1_Timer()<br> Dim i As Integer<br> For i = 0 To 49<br> PSet (X(i), Y(i)), &H0&<br> If X(i) < 0 Or X(i) > Form1.ScaleWidth Or Y(i) < 0 Or Y(i) > Form1.ScaleHeight Then<br> X(i) = Form1.ScaleWidth \ 2<br> Y(i) = Form1.ScaleHeight \ 2<br> xSpeed(i) = Int(Rnd(1) * 200) - 100<br> ySpeed(i) = Int(Rnd(1) * 200) - 100<br> End If<br> X(i) = X(i) + xSpeed(i)<br> Y(i) = Y(i) + ySpeed(i)<br> PSet (X(i), Y(i)), &HFFFFFF<br> Next i<br> End Sub</small></small></small></small></font></p>
Original Comments (3)
Recovered from Wayback Machine