Animated line drawing in Computer Graphics
Here you will get and learn the program code of animated line drawing in computer graphics using for loop and putpixel function. This is an initial example of animation in c graphics.
Program code of Animated line drawing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<graphics.h> #include<stdio.h> #include<conio.h> void main() { int i,x,y,gd = DETECT, gm; x=100,y=100; clrscr(); initgraph(&gd, &gm, "C:\TURBOC3\BGI"); for(i=1;i<100;i++) { putpixel(x+i,y+i,RED); delay(100); } getch(); //unloads graphics drivers closegraph(); } |
Output
Read Also
Draw a Line using line function()