drawing lines with a delay
Posted: Tue Dec 22, 2009 3:04 am
how do you draw lines with a delay of, say 5 seconds, between each line - below is my code - the problem is that the statement ImagePng($handle) draws the image after the plot and doesn't seem to accept being called more than once:
$x1=0;
$y1=0;
$first_one="yes";
while($nt=mysql_fetch_array($qt)){
$x2=$x1+$x_gap; // Shifting in X axis
$y2=$y_max-$nt[sales]; // Coordinate of Y axis
if($first_one=="no"){ // this is to prevent from starting $x1= and $y1=0
imageline ($handle,$x1, $y1,$x2,$y2,$txt_color); // Drawing the line between two points
ImagePng ($handle);
sleep(2);
}
$x1=$x2; // Storing the value for next draw
$y1=$y2;
$first_one="no"; // Now flag is set to allow the drawing
}
ImagePng ($handle);
thanks
Abbey
$x1=0;
$y1=0;
$first_one="yes";
while($nt=mysql_fetch_array($qt)){
$x2=$x1+$x_gap; // Shifting in X axis
$y2=$y_max-$nt[sales]; // Coordinate of Y axis
if($first_one=="no"){ // this is to prevent from starting $x1= and $y1=0
imageline ($handle,$x1, $y1,$x2,$y2,$txt_color); // Drawing the line between two points
ImagePng ($handle);
sleep(2);
}
$x1=$x2; // Storing the value for next draw
$y1=$y2;
$first_one="no"; // Now flag is set to allow the drawing
}
ImagePng ($handle);
thanks
Abbey