Results 1 to 4 of 4

Thread: Graphic action

  1. #1

    Thread Starter
    New Member uttamsaxena's Avatar
    Join Date
    Mar 2001
    Location
    India
    Posts
    13

    Lightbulb Graphic action

    I want to know how can I make a line appear slowly from one end to another end,to make user feel that someone is drawing that line.

  2. #2
    New Member
    Join Date
    Apr 2001
    Posts
    11
    u could just slowly change the length of the line in small increments.

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Try setting a timer..... and make sure a global const is in place (mcIntervals), to execute this code. Also have the X1, Y1, X2, Y2 values you need for drawing a line: (in X1, X2, Y1, Y2)

    Code:
    'after line is drawn set timer1's enabled property to true
    'start timer1 with enabled=false
    Dim unsInt as Integer
    Const mcIntervals = 100
        '---> set x1, x2, y1, y2 here and enable timer1...
    Private Sub Timer1_Timer()
    Dim TempX2, TempY2
       unsInt = unsInt + 1
          TempX2 = ((x1 - x2) / mcIntervals) * unsInt
          TempX2 = X1 + TempX2
          TempY2 = ((y1 - y2) / mcIntervals) * unsInt
          TempY2 = y1 + Tempy2
       Me.Cls
       Me.Line (X1, TempX2)-(Y1, TempY2)
       If unsInt = mcIntervals then
          unsInt = 0
          Timer1.Enabled = False
       End If
    End Sub
    This timer event draws a line (well in this example 1 - 100%) of the way to the finish point, at an interval of the timer. If you set the mcIntervals constant to 50 then it would take half as long and wouldn't look as good.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I noticed a few odd bits in the code when I tried it myself; here is an updated version:

    Code:
    'after line is drawn set timer1's enabled property to true
    'start timer1 with enabled=false
    Dim unsInt As Integer
    Const mcIntervals = 100
        '---> set x1, x2, y1, y2 here and enable timer1...
    Private Sub Timer1_Timer()
    Dim TempX2, TempY2
       unsInt = unsInt + 1
          TempX2 = ((X1 - X2) / mcIntervals) * unsInt
          TempX2 = -TempX2
          TempX2 = Int(X1 + TempX2)
          TempY2 = ((Y1 - Y2) / mcIntervals) * unsInt
          TempY2 = -TempY2
          TempY2 = Int(Y1 + TempY2)
       Me.Cls
       Me.Line (X1, Y1)-(TempX2, TempY2)
       If unsInt = mcIntervals Then
          unsInt = 0
          Timer1.Enabled = False
       End If
    End Sub
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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