Results 1 to 3 of 3

Thread: Make a line spin,,,,,,

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg , Denmark
    Posts
    1,544

    Wink

    How can I make a line spin around its own center???
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    Private Sub Form_Activate()
    Dim centerx&, centery&, radius&, angle!
    centerx = (Line1.X1 + Line1.X2) / 2
    centery = (Line1.Y1 + Line1.Y2) / 2
    radius = Sqr((Line1.Y1 - Line1.Y2) ^ 2 + (Line1.X1 - Line1.X2) ^ 2) / 2
    Do
        angle = angle + 0.01
        Line1.X1 = centerx + Cos(angle) * radius
        Line1.X2 = centerx + Cos(angle + 3.1415) * radius
        Line1.Y1 = centery + Sin(angle) * radius
        Line1.Y2 = centery + Sin(angle + 3.1415) * radius
        DoEvents
        If angle > 6.283 Then angle = angle - 6.283
        caption = angle
    Loop While Forms.Count
    
    End Sub
    Put this on the form with a line, and run!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg , Denmark
    Posts
    1,544
    Thanks you very much! Thats just what I was looking for!!
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width