Hello guys Im working on this project were I have to make the shape of my inicials "HIP" then make the letter H rotate on its center against the clock + make it rotate clock wise around the letter "I". I also have to make the letter "P" move up and down. The letter "I" stay fit on its location. I could make the "H' rotate on its center and around the letter "I" but not at the same time. I also could move the letter "P" up or down but I dont know how to make it doit on it self with the timer. I welcome you to help me on this one thanks in advance. Here is the code and a attach file so you could have a peek.

Const hsize = 13
Const isize = 12
Const psize = 6
Const rotAngle = -0.04
Const rotAngle2 = 0.04
Const desplazamineto = 10
Dim hsizeX(hsize), hsizeY(hsize)
Dim hX1(hsize), hY1(hsize)
Dim hX2(hsize), hY2(hsize)
Dim isizeX(isize), isizeY(isize)
Dim psizeX(psize), psizeY(psize)

Private Sub drawLetras()

'Draws Letter H
Picture1.Line (hsizeX(1), hsizeY(1))-(hsizeX(2), hsizeY(2))
Picture1.Line (hsizeX(2), hsizeY(2))-(hsizeX(3), hsizeY(3))
Picture1.Line (hsizeX(3), hsizeY(3))-(hsizeX(4), hsizeY(4))
Picture1.Line (hsizeX(4), hsizeY(4))-(hsizeX(5), hsizeY(5))
Picture1.Line (hsizeX(5), hsizeY(5))-(hsizeX(6), hsizeY(6))
Picture1.Line (hsizeX(6), hsizeY(6))-(hsizeX(7), hsizeY(7))
Picture1.Line (hsizeX(7), hsizeY(7))-(hsizeX(8), hsizeY(8))
Picture1.Line (hsizeX(8), hsizeY(8))-(hsizeX(9), hsizeY(9))
Picture1.Line (hsizeX(9), hsizeY(9))-(hsizeX(10), hsizeY(10))
Picture1.Line (hsizeX(10), hsizeY(10))-(hsizeX(11), hsizeY(11))
Picture1.Line (hsizeX(11), hsizeY(11))-(hsizeX(12), hsizeY(12))
Picture1.Line (hsizeX(12), hsizeY(12))-(hsizeX(1), hsizeY(1))

'Draws Letter I
Picture1.Line (isizeX(1), isizeY(1))-(isizeX(2), isizeY(2))
Picture1.Line (isizeX(2), isizeY(2))-(isizeX(3), isizeY(3))
Picture1.Line (isizeX(3), isizeY(3))-(isizeX(4), isizeY(4))
Picture1.Line (isizeX(4), isizeY(4))-(isizeX(5), isizeY(5))
Picture1.Line (isizeX(5), isizeY(5))-(isizeX(6), isizeY(6))
Picture1.Line (isizeX(6), isizeY(6))-(isizeX(7), isizeY(7))
Picture1.Line (isizeX(7), isizeY(7))-(isizeX(8), isizeY(8))
Picture1.Line (isizeX(8), isizeY(8))-(isizeX(9), isizeY(9))
Picture1.Line (isizeX(9), isizeY(9))-(isizeX(10), isizeY(10))
Picture1.Line (isizeX(10), isizeY(10))-(isizeX(11), isizeY(11))
Picture1.Line (isizeX(11), isizeY(11))-(isizeX(12), isizeY(12))
Picture1.Line (isizeX(12), isizeY(12))-(isizeX(1), isizeY(1))

'Draws Letter P
Picture1.Line (psizeX(1), psizeY(1))-(psizeX(2), psizeY(2))
Picture1.Line (psizeX(2), psizeY(2))-(psizeX(3), psizeY(3))
Picture1.Line (psizeX(3), psizeY(3))-(psizeX(4), psizeY(4))
Picture1.Line (psizeX(4), psizeY(4))-(psizeX(5), psizeY(5))
Picture1.Line (psizeX(5), psizeY(5))-(psizeX(6), psizeY(6))
Picture1.Line (psizeX(6), psizeY(6))-(psizeX(1), psizeY(1))
End Sub

'==========================================================
'I need to make this letter move up and down ones she reaches the end of the pictures scale
'==========================================================
'Moves the letter P Up
Private Sub moverP(disp)
Dim i As Integer
For i = 1 To psize
psizeY(i) = psizeY(i) + disp ' If signal is change to - Then Letter P will move down
Next i
End Sub

'=====================================
'This part of the code makes the letter H rotate aroud (0,0)
'=====================================
Private Sub rotateAroundPoint(x, y, ang, xp, yp)
Dim nx, ny As Double
nx = ((x - xp) * Cos(ang) - (y - yp) * Sin(ang)) + xp
ny = ((x - xp) * Sin(ang) + (y - yp) * Cos(ang)) + xp
x = nx
y = ny
End Sub

'====================================================
'This part makes the letter H rotate against the clock on her center an arround X,Y 
'(0,0) clock wise but its not working correctly
'====================================================
Private Sub rotateHsize()
Dim i As Integer
Dim newX
Dim newY

For i = 1 To hsize
      Call rotateAroundPoint(hX2(i), hY2(i), rotAngle, 0, 0)
      hX1(i) = hX2(i)
      hY1(i) = hY2(i)
Next i

newX = hX1(13)
newY = hY1(13)
For i = 1 To hsize
     Call rotateAroundPoint(hX1(i), hY1(i), rotAngle, newX, newY)
Next i

For i = 1 To hsize
   hsizeX(i) = hX1(i)
  hsizeY(i) = hY1(i)
Next i


Picture1.Cls
Call drawLetras
End Sub

Private Sub Form_Load()
Dim n As Integer

Picture1.Scale (100, 100)-(-100, -100)

'Letter H Values
hsizeX(1) = 15: hsizeY(1) = -10
hsizeX(2) = 15: hsizeY(2) = 10
hsizeX(3) = 20: hsizeY(3) = 10
hsizeX(4) = 20: hsizeY(4) = 5
hsizeX(5) = 30: hsizeY(5) = 5
hsizeX(6) = 30: hsizeY(6) = 10
hsizeX(7) = 35: hsizeY(7) = 10
hsizeX(8) = 35: hsizeY(8) = -10
hsizeX(9) = 30: hsizeY(9) = -10
hsizeX(10) = 30: hsizeY(10) = -5
hsizeX(11) = 20: hsizeY(11) = -5
hsizeX(12) = 20: hsizeY(12) = -10
hsizeX(13) = 25: hsizeY(13) = 1

'Stores new valus for H wile is moving
For n = 1 To hsize
    hX1(n) = hsizeX(n)
    hY1(n) = hsizeY(n)
    hX2(n) = hsizeX(n)
    hY2(n) = hsizeY(n)
Next n

'Letter I Values
isizeX(1) = -10: isizeY(1) = -10
isizeX(2) = -10: isizeY(2) = -5
isizeX(3) = -5: isizeY(3) = -5
isizeX(4) = -5: isizeY(4) = 5
isizeX(5) = -10: isizeY(5) = 5
isizeX(6) = -10: isizeY(6) = 10
isizeX(7) = 10: isizeY(7) = 10
isizeX(8) = 10: isizeY(8) = 5
isizeX(9) = 5: isizeY(9) = 5
isizeX(10) = 5: isizeY(10) = -5
isizeX(11) = 10: isizeY(11) = -5
isizeX(12) = 10: isizeY(12) = -10

'Letter P Values
psizeX(1) = -25: psizeY(1) = -10
psizeX(2) = -25: psizeY(2) = 0
psizeX(3) = -35: psizeY(3) = 0
psizeX(4) = -35: psizeY(4) = 10
psizeX(5) = -15: psizeY(5) = 10
psizeX(6) = -15: psizeY(6) = -10

Timer1.Enabled = True
Timer1.Interval = 100

End Sub

Private Sub Timer1_Timer()
Call drawLetras
Call rotateHsize
Call moverP(desplazamineto)
End Sub

From your code i am not sure what are you trying to do .
And where is the letter P ?

I made some changes to the code here is the new one. I still have the same problem. The values of the letter P are in betwen line 118 to 123. The codes that draws the leter P is in betwen line 43 to 48. Im trying to make the letter H rotate around the letter I just like the moon rotates around the earth and its self. I also want the letter P to move up and down.

Const hsize = 13
Const isize = 12
Const psize = 6
Const rotAngle = -0.04
Const rotAngle2 = 0.04
Const desplazamineto = 10
Const ampFactor = 1.2
Dim hsizeX(hsize), hsizeY(hsize)
Dim isizeX(isize), isizeY(isize)
Dim psizeX(psize), psizeY(psize)

Private Sub drawLetras()

'Draws Letter H
Picture1.Line (hsizeX(1), hsizeY(1))-(hsizeX(2), hsizeY(2))
Picture1.Line (hsizeX(2), hsizeY(2))-(hsizeX(3), hsizeY(3))
Picture1.Line (hsizeX(3), hsizeY(3))-(hsizeX(4), hsizeY(4))
Picture1.Line (hsizeX(4), hsizeY(4))-(hsizeX(5), hsizeY(5))
Picture1.Line (hsizeX(5), hsizeY(5))-(hsizeX(6), hsizeY(6))
Picture1.Line (hsizeX(6), hsizeY(6))-(hsizeX(7), hsizeY(7))
Picture1.Line (hsizeX(7), hsizeY(7))-(hsizeX(8), hsizeY(8))
Picture1.Line (hsizeX(8), hsizeY(8))-(hsizeX(9), hsizeY(9))
Picture1.Line (hsizeX(9), hsizeY(9))-(hsizeX(10), hsizeY(10))
Picture1.Line (hsizeX(10), hsizeY(10))-(hsizeX(11), hsizeY(11))
Picture1.Line (hsizeX(11), hsizeY(11))-(hsizeX(12), hsizeY(12))
Picture1.Line (hsizeX(12), hsizeY(12))-(hsizeX(1), hsizeY(1))

'Draws Letter I
Picture1.Line (isizeX(1), isizeY(1))-(isizeX(2), isizeY(2))
Picture1.Line (isizeX(2), isizeY(2))-(isizeX(3), isizeY(3))
Picture1.Line (isizeX(3), isizeY(3))-(isizeX(4), isizeY(4))
Picture1.Line (isizeX(4), isizeY(4))-(isizeX(5), isizeY(5))
Picture1.Line (isizeX(5), isizeY(5))-(isizeX(6), isizeY(6))
Picture1.Line (isizeX(6), isizeY(6))-(isizeX(7), isizeY(7))
Picture1.Line (isizeX(7), isizeY(7))-(isizeX(8), isizeY(8))
Picture1.Line (isizeX(8), isizeY(8))-(isizeX(9), isizeY(9))
Picture1.Line (isizeX(9), isizeY(9))-(isizeX(10), isizeY(10))
Picture1.Line (isizeX(10), isizeY(10))-(isizeX(11), isizeY(11))
Picture1.Line (isizeX(11), isizeY(11))-(isizeX(12), isizeY(12))
Picture1.Line (isizeX(12), isizeY(12))-(isizeX(1), isizeY(1))

'Draws Letter P
Picture1.Line (psizeX(1), psizeY(1))-(psizeX(2), psizeY(2))
Picture1.Line (psizeX(2), psizeY(2))-(psizeX(3), psizeY(3))
Picture1.Line (psizeX(3), psizeY(3))-(psizeX(4), psizeY(4))
Picture1.Line (psizeX(4), psizeY(4))-(psizeX(5), psizeY(5))
Picture1.Line (psizeX(5), psizeY(5))-(psizeX(6), psizeY(6))
Picture1.Line (psizeX(6), psizeY(6))-(psizeX(1), psizeY(1))
End Sub

'Moves the letter P Up
Private Sub moverP(disp)
Dim i As Integer
If psizeY(1) > 5 Then
For i = 1 To psize
psizeY(i) = psizeY(i) - disp
Next i
ElseIf psizeY(2) > -5 Then
For i = 1 To psize
psizeY(i) = psizeY(i) + disp
Next i
End If
End Sub

'Moves the letter P down
Private Sub moverPD(disp)
Dim i As Integer
For i = 1 To psize
psizeY(i) = psizeY(i) - disp
Next i
End Sub

'Makes letters rotate aroun their point
Private Sub rotateAroundPoint(x, y, ang, xp, yp)
Dim nx, ny As Double
nx = ((x - xp) * Cos(ang) - (y - yp) * Sin(ang)) + xp
ny = ((x - xp) * Sin(ang) + (y - yp) * Cos(ang)) + xp
x = nx
y = ny
End Sub

Private Sub Form_Load()
Dim n As Integer

Picture1.Scale (100, 100)-(-100, -100)

'Letter H Values
hsizeX(0) = 0: hsizeY(0) = 0
hsizeX(1) = 15: hsizeY(1) = -10
hsizeX(2) = 15: hsizeY(2) = 10
hsizeX(3) = 20: hsizeY(3) = 10
hsizeX(4) = 20: hsizeY(4) = 5
hsizeX(5) = 30: hsizeY(5) = 5
hsizeX(6) = 30: hsizeY(6) = 10
hsizeX(7) = 35: hsizeY(7) = 10
hsizeX(8) = 35: hsizeY(8) = -10
hsizeX(9) = 30: hsizeY(9) = -10
hsizeX(10) = 30: hsizeY(10) = -5
hsizeX(11) = 20: hsizeY(11) = -5
hsizeX(12) = 20: hsizeY(12) = -10
hsizeX(13) = 25: hsizeY(13) = 0

'Letter I Values
isizeX(1) = -10: isizeY(1) = -10
isizeX(2) = -10: isizeY(2) = -5
isizeX(3) = -5: isizeY(3) = -5
isizeX(4) = -5: isizeY(4) = 5
isizeX(5) = -10: isizeY(5) = 5
isizeX(6) = -10: isizeY(6) = 10
isizeX(7) = 10: isizeY(7) = 10
isizeX(8) = 10: isizeY(8) = 5
isizeX(9) = 5: isizeY(9) = 5
isizeX(10) = 5: isizeY(10) = -5
isizeX(11) = 10: isizeY(11) = -5
isizeX(12) = 10: isizeY(12) = -10

'Letter P Values
psizeX(1) = -25: psizeY(1) = -10
psizeX(2) = -25: psizeY(2) = 0
psizeX(3) = -35: psizeY(3) = 0
psizeX(4) = -35: psizeY(4) = 10
psizeX(5) = -15: psizeY(5) = 10
psizeX(6) = -15: psizeY(6) = -10

Timer1.Enabled = True
Timer1.Interval = 100

End Sub

Private Sub Timer1_Timer()
Call drawLetras
'==============================================
'Moves letter H around letter its center
Call rotateHsize2
'==============================================
'Moves letter H aroun I but not at the same time
'==============================================
Call rotateHsize3
Call moverP(desplazamineto)
Call ampliarP(ampFactor, ampFactor)
Call drawLetras
End Sub

Private Sub rotateHsize2()
Dim i
For i = 1 To hsize
Call rotateAroundPoint(hsizeX(i), hsizeY(i), rotAngle, hsizeX(13), hsizeY(13))
Next i
Picture1.Cls
Call drawLetras
End Sub

Private Sub rotateHsize3()
Dim i
For i = 1 To hsize
Call rotateAroundPoint(hsizeX(i), hsizeY(i), rotAngle2, hsizeX(0), hsizeY(0))
Next i
Picture1.Cls
Call drawLetras
End Sub

Private Sub ampliarP(Ax, Ay)
Dim i
For i = 1 To psize
Call ampliarLetra(psizeX(i), psizeY(i), Ax, Ay, psizeX(0), psizeY(0))
Next i
End Sub

Private Sub ampliarLetra(x, y, Ax, Ay, px, py)
Dim nx, ny
nx = (x - px) * Ax + px
ny = (y - py) * Ay + py
x = nx
y = ny
End Sub
This article has been dead for over six months. Start a new discussion instead.