Animasi Bintang Berjatuhan
https://carakuvb6.blogspot.com/2017/11/animasi-bintang-berjatuhan.html
Animasi secara garis besar kita kenal dengan suatu object yang bergerak baik berulang-ulang secara teratur ataupun secara acak (random). Biasa animasi dalam pemrograman digunakan untuk mempercantik tampilan agar lebih elegan. Pada pembahasan kali ini, admin akan share sourcode Animasi Bintang Berjatuhan.
Komponen yang digunakan dalam pembuatan sourcode ini hanya Timer dan Form sebagai media awal. Buka Ms. Visual Basic 6.0 (VB6) - StandarEXE kemudian buat Form1 dan tambahkan komponen Timer, untuk Timer dengan interval 50.
Double klik pada form pilih Pilih (General) dan (Declaration) seperti gambar dibawah ini
Kemudian pastekan syntak dibawah ini
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Type Star
X As Long
Y As Long
Speed As Long
Size As Long
Color As Long
End Type
Dim Stars(49) As Star
Const MaxSize As Long = 5
Const MaxSpeed As Long = 25
Double klik pada komponen Timer dan pastekan syntak dibawah iniPrivate Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Type Star
X As Long
Y As Long
Speed As Long
Size As Long
Color As Long
End Type
Dim Stars(49) As Star
Const MaxSize As Long = 5
Const MaxSpeed As Long = 25
Dim I As Long
BitBlt Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, 0, 0, 0, vbBlackness
For I = 0 To UBound(Stars)
Stars(I).Y = (Stars(I).Y Mod Me.ScaleHeight) + Stars(I).Speed
If Stars(I).Y > Me.ScaleHeight Then
Stars(I).X = Me.ScaleWidth * Rnd + 1
Stars(I).Speed = MaxSpeed * Rnd + 1
End If
Me.FillColor = Stars(I).Color
Me.ForeColor = Stars(I).Color
Ellipse Me.hdc, Stars(I).X, Stars(I).Y, Stars(I).X + Stars(I).Size, Stars(I).Y + Stars(I).Size
Next I
Me.Refresh
Double klik pada Form dan pilih Prosedur Form_Load pastekan juga syntak dibawah ini
Dim I As Long
Randomize
For I = LBound(Stars) To UBound(Stars)
Stars(I).X = Me.ScaleWidth * Rnd + 1
Stars(I).Y = Me.ScaleHeight * Rnd + 1
Stars(I).Size = MaxSize * Rnd + 1
Stars(I).Speed = MaxSpeed * Rnd + 1
Stars(I).Color = RGB(Rnd * 255 + 1, Rnd * 255 + 1, Rnd * 255 + 1)
Next I
Kemudian pilih prosedur Form_KeyDown dan patekan syntak ini
Unload Me
Simpan dan kemudian Run/F5, Animasi titik-titik berkedap-kedip seperti Bintang Berjatuhan pun tampil seperti gambar diawal pembahasan.
Maaf min, saya coba pake kode ini, tapi kok animasinya nggak ada ya
ReplyDeleteAnimasi Bintang Berjatuhan >>>>> Download Now
ReplyDelete>>>>> Download Full
Animasi Bintang Berjatuhan >>>>> Download LINK
>>>>> Download Now
Animasi Bintang Berjatuhan >>>>> Download Full
>>>>> Download LINK rg