Home > Visual Basic 6 > Efek Gerakan Bintang (Star Motion) Pada Form Di Visual Basic

Efek Gerakan Bintang (Star Motion) Pada Form Di Visual Basic

Source code berikut untuk membuat efek Star Motion pada background form di Visual Basic. Bintang-bintang berwarna-warni bergerak menyebar secara random di tengah-tengah form.

Buat 1 project dengan :
1 Form
1 Timer

Copy source code berikut pada Form : 

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

Untuk lebih jelasnya, Download Source Code Efek Star Motion Pada Form Di Visual Basic.


Referensi :
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=23378&lngWId=1

  1. January 17, 2011 at 2:59 pm

    yooo dicoba….

  2. January 22, 2011 at 4:47 pm

    OK… banget… Thank’s ya Master

  3. godli
    February 3, 2011 at 2:10 am

    kenalkan nama saya godli saya mau tanya gima cara membuat icon di vb 6 saat kita sentuh dengan cursor langsung mengeluar cahaya atau perputar icon tersebut tolong kirimkan ke email saya terima kasih

  4. ce_amatiran
    February 13, 2011 at 12:07 pm

    kalo button nya gak mesti petak gt ada yang tau gak?

  5. November 4, 2011 at 9:44 pm

    Thanks gan !!

  6. indra
    December 1, 2011 at 9:38 pm

    thanks mister..
    neomu gamsahamnida…..:)

  7. indra
    December 1, 2011 at 9:40 pm

    gan mau tanya..kode untuk membuat program pencari data di vb gmana??

  8. February 20, 2012 at 2:55 pm

    thankz bro..

  9. March 8, 2012 at 12:00 am

    Izin Copass Gannzz

  10. ahmad
    June 8, 2012 at 8:53 pm

    wah ini kutu yang makan label heee

  11. freddy
    September 18, 2012 at 9:08 am

    gak bisa bro gak jelas

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: