!**************************************
! Name: Efek Tulisan
! Description : menggerakan teks secara
! acak
! copyright : Maggot #10
! www.master.ac.id
!**************************************
1. Tambahkan komponen PictureBox dan Command1
2. Listing pada Command1 :
Private Sub Command1_Click()
Randomize Timer
Dim StartTime(100)
Dim DownMovement(100) As Boolean
Dim MoveDistance As Double
Dim YPos(100) As Double
Dim MovementDone(100) As Boolean
Dim StartHeight(100) As Double
Dim UpMovementTime(100) As Double
Dim PowerLoss(100) As Double
Dim Message As String
Dim Looop As Integer
Dim TextColor(200) As ColorConstants
Picture1.ScaleMode = 4
Picture1.FontName = "Verdana"
Message = "For All Maggot Wherever You Are..."
For Looop = 1 To Len(Message)
PowerLoss(Looop) = 0.2 + ((Rnd * 25) / 100)
StartHeight(Looop) = 0
TextColor(Looop) = RGB(80 + Looop * 2, 80 + Looop * 2, 255)
Next Looop
For Looop = 1 To Len(Message)
StartTime(Looop) = Timer
Next Looop
Do
Picture1.Cls
For Looop = 1 To Len(Message)
If DownMovement(Looop) = True Then
MoveDistance = (StartHeight(Looop) + (0.5 * 9.81 * ((Timer - StartTime(Looop)) ^ 2)))
If YPos(Looop) >= Picture1.ScaleHeight - 1 Then MovementDone(Looop) = True
Else
MoveDistance = (StartHeight(Looop) + (0.5 * 9.81 * (UpMovementTime(Looop) - (Timer - StartTime(Looop))) ^ 2))
If YPos(Looop) <= StartHeight(Looop) + 0.1 Then MovementDone(Looop) = True
End If
YPos(Looop) = MoveDistance
If YPos(Looop) > Picture1.ScaleHeight - 1 Then
YPos(Looop) = Picture1.ScaleHeight - 1
End If
Picture1.CurrentX = Picture1.ScaleWidth / 2 - Int((Len(Message) / 2)) + Looop
Picture1.CurrentY = YPos(Looop)
Picture1.ForeColor = TextColor(Looop)
Picture1.Print Mid(Message, Looop, 1)
Next Looop
DoEvents
For Looop = 1 To Len(Message)
If MovementDone(Looop) = True Then
If DownMovement(Looop) = True Then
DownMovement(Looop) = False
StartHeight(Looop) = StartHeight(Looop) + ((Picture1.ScaleHeight - StartHeight(Looop)) * PowerLoss(Looop))
UpMovementTime(Looop) = Sqr((Picture1.ScaleHeight - StartHeight(Looop)) / (0.5 * 9.81))
Else
DownMovement(Looop) = True
End If
StartTime(Looop) = Timer
MovementDone(Looop) = False
End If
Next Looop
Loop
End Sub