Skip to content

Instantly share code, notes, and snippets.

@pyldin601
Created May 7, 2019 18:50
Show Gist options
  • Save pyldin601/2226581667a6fae23e1329fba450f326 to your computer and use it in GitHub Desktop.
Save pyldin601/2226581667a6fae23e1329fba450f326 to your computer and use it in GitHub Desktop.
Dim TMPX As Long
Dim TMPX2 As Long
Const nrg1 As Integer = 100
Dim ampl As Currency
Dim phase As Currency
Dim currPh As Currency
Dim li As Currency
Dim spd As Currency
Dim R As Integer
Dim MeMovX, MeMovY
Dim MeOldX, MeOldY
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
TMPX = X
End Sub
Private Sub Timer1_Timer()
Picture2.Scale (-104, -119)-(104, 0)
MeMovX = (Me.Left - MeOldX) / 400
MeMovY = (Me.Top - MeOldY) / 1000
MeOldX = Me.Left: MeOldY = Me.Top
X = phase - TMPX
k = 0.01
R = 100
spd = spd + (-k * X / 1) - MeMovX + MeMovY
spd = spd * 0.9
phase = phase + spd
If phase < 0 Then spd = -spd: phase = 0
If phase > 80 Then spd = -spd: phase = 80
li = (6.28 / 100 * (phase / 3 + 37))
Picture2.Cls
Picture2.Line (0, 30)-(R * -Sin(li), 30 + R * Cos(li)), vbRed
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment