Animasi Bola Turun
https://carakuvb6.blogspot.com/2017/11/animasi-bola-turun.html
Pada postingan artikel kali ini admin akan membahas tentang pembuatan sebuah animasi menggunakan Visual Basic 6.0 (Vb6), pada pembahasan sebelumnya untuk jenis animasi seperti Animasi Slide Scrolling Image dan Animasi Bintang Berjatuhan memang sudah dibahas, dan kali ini sengaja admin bahas kembali tetapi dengan judul dan jenis animasi yang berbeda dan pergerakan bola animasi yang jatuh pun mengecil dan membesar secara interval pada komponen timer yang ada didalam form tersebut.
Buka Ms. Visual Basic 6.0 - StandarEXE buatlah form dan tambahkan CommanButton, Timer, PictureBox dan kurang lebih seperti gambar ini
Sekarang kita copykan syntaknya, double klik pada Form pilih prosedur (General) dan (Declarations)
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop 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
Dim Shrinking As Boolean
Dim Stretch As Long
Const SpriteWidth As Long = 64
Const SpriteHeight As Long = 64
Const MaxStretch As Long = 96
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop 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
Dim Shrinking As Boolean
Dim Stretch As Long
Const SpriteWidth As Long = 64
Const SpriteHeight As Long = 64
Const MaxStretch As Long = 96
Double klik pada CommanButton dan copykan syntak dibawah ini
Stretch = 64
Shrinking = False
TimerStretch.Enabled = True
Dan yang terakhir double klik juga pada Timer dan copykan syntak dibawah iniStretch = 64
Shrinking = False
TimerStretch.Enabled = True
Static X As Long, Y As Long
Me.Cls
If Shrinking Then
Stretch = Stretch - 2
Else
Stretch = Stretch + 2
End If
If Stretch < 32 Then Shrinking = False
If Stretch > MaxStretch Then Shrinking = True
StretchBlt Me.hdc, X, Y, Stretch, Stretch, picMask.hdc, 0, 0, SpriteWidth, SpriteHeight, vbSrcAnd
StretchBlt Me.hdc, X, Y, Stretch, Stretch, picSprite.hdc, 0, 0, SpriteWidth, SpriteHeight, vbSrcPaint
X = (X Mod Me.ScaleWidth) + 2
Y = (Y Mod Me.ScaleHeight) + 2
Me.Refresh
Untuk interval Timer bisa sesuka agan-agan saja menurut selera, kemudian simpan project diatas kemudian Run/F5. Untuk sourcodenya bisa didownload di LINK INI
Animasi Bola Turun >>>>> Download Now
ReplyDelete>>>>> Download Full
Animasi Bola Turun >>>>> Download LINK
>>>>> Download Now
Animasi Bola Turun >>>>> Download Full
>>>>> Download LINK kW