Advertisement
ASP_Volume2 Custom Controls/ Forms/ Menus #36851

Ripple Effect

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.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
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
Commenti originali (3)
Recuperato da Wayback Machine