|
-
Apr 29th, 2001, 02:06 PM
#1
Thread Starter
New Member
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.
-
Apr 29th, 2001, 03:47 PM
#2
New Member
u could just slowly change the length of the line in small increments.
-
Apr 29th, 2001, 04:09 PM
#3
Good Ol' Platypus
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)
-
Apr 29th, 2001, 04:14 PM
#4
Good Ol' Platypus
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|