In your drawing equation:
give the "(x2,y2)" variable values, from minimum "(x1,y1)" to maximum "(x2,y2)"
and then use a timer to increase the "(x2,y2)" until it reaches the point you want.
ok, I tried this by putting all the x,y coordinates into two arrays x() and y() and trying the code below. This works and all the lines between the x and y's are drawn in one go. The vertical distance between the x coordinates is fixed so the resulting line is a zig-zag pattern.
For i=1 To 9
Linecvs.DrawLine(x(i-1),y(i-1),x(i),y(i),Colors.Blue,ChartLineWidth)
'allpanels(2) is a panel that holds the canvas
allpanels(2).Invalidate
Next
Now, when I want to show the line "growing" from one x to the next x, I tried the code below.
tantheta is the trignometric relation to calculate the incremental increase in x based on a fixed step value in y from y(i) to y(i+1). The code starts at x(i), y(i) then increments in 10 deltay steps to x(i+1), y(i+1) with the new position of each incremetnal x is calculated based on the incremental y value. This should then show the line growing in 10 incremental steps from x(i), y(i) to x(i+1), y(i+1). The logs show that the corect x and y values are being generated. However, IT DOES NOT WORK. With the Do While Loop, no line drawing occurs at all and with the Do Loop removed it just plots the line in one go.
For i=0 To 9
tantheta=(y(1)-y(0))/(x(i)-x(i-1))
deltay=(y(1)-y(0))/10
oldx=x(i)
for j=1 to 9
newx=(j*deltay)/tantheta
Linecvs.DrawLine(oldx,y(i)+((j-1)*deltay), newx, y(i)+((j*deltay),Colors.Blue,ChartLineWidth)
oldx=newx
now=DateTime.now + 100
Do While DateTime.now<now
Loop
allpanels(2).Invalidate
Next
Next
Is this because the redrawing of the canvas has to occur after the code is finished? (I have a separate Translation animation based on the x and y values that executes perfectly before I want to draw the growing line).
I'm after a smooth aniamtion of this growing line - Does anyone have any suggestions why this method doesn't work or an alternativwe way of animating a growing line? Thanks