by Butterkeks (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(5 Votes)
This is an ripple effect (well, it seems to be), which uses pure VB. My friends say, they look like ripples, but I don't. Just Hold the mouse over the form and move it.
Code Returns
Something good (I hope)
Private Type RippleType
X As Long
Y As Long
wid As Long
color As Long
speed As Integer
Maxwid As Integer
End Type
Dim Ripple(0 To 250) As RippleType
Dim LeftP
Dim TopP
Dim Draw As Boolean
Sub Init(nr)
With Ripple(nr)
.wid = 0
.X = LeftP
.Y = TopP
.color = 255
.speed = Int((40 * Rnd) + 20)
.Maxwid = Int((2000 * Rnd) + 1)
End With
End Sub
Private Sub Form_Load()
For I = 0 To UBound(Ripple)
Init I
Next I
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Draw = True Then
LeftP = X
TopP = Y
Init I
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Draw = False
End Sub
Private Sub Timer1_Timer()
Me.Cls
For I = 0 To UBound(Ripple)
With Ripple(I)
.color = .color - .speed / 4
If .color < 0 Then
If Draw = True Then Init I
If Draw = False Then .color = 0
End If
.wid = .wid + .speed
If Draw = True Then
If .wid > .Maxwid Then Init I
End If
Me.Circle (.X, .Y), .wid, RGB(0, 0, .color)
End With
Next I
End Sub