Search Tools Links Login

Ripple Effect


Visual Basic 6, or VB Classic

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.

Original Author: // (- |)

Returns

Something good (I hope)

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 97 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.