Tag Archives: animation

Draw “marching ants” dashed lines in C#

The example Draw dashed lines that are visible on any background in C# shows how to draw lines that are visible above any backgrounds. If the background is very cluttered, however, it may still be somewhat hard to see the … Continue reading

Posted in animation, drawing, graphics | Tagged , , , , , , , , , , , , , | 4 Comments

Make a cannon game in C#

This simple cannon game randomly positions a target house. Then when you click the Shoot button, it gets angle and speed information for the cannon and enables a timer. To keep the graphics and timing simple, the program uses a … Continue reading

Posted in algorithms, animation, games, graphics | Tagged , , , , , , , , , , , , , | Leave a comment

Animate images in C#

This example shows how to animate images by loading them at run time and then playing them one at a time. To make finding the images easier, I added them to the project. (Open the Project menu, select Add Existing … Continue reading

Posted in algorithms, animation, image processing | Tagged , , , , , , , , , , | Leave a comment

Draw gears in C#

This example uses the following DrawGear method to draw gears. // Draw a gear. private void DrawGear(Graphics gr, Brush axle_brush, Brush gear_brush, Pen gear_pen, PointF center, float radius, float tooth_length, int num_teeth, float axle_radius, bool start_with_tooth) { float dtheta = … Continue reading

Posted in algorithms, animation, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , | 1 Comment

Draw an analog clock in C#

This example demonstrates several useful techniques including: Context menus Restricting a form to a region to give it a shape. Moving a form with no title bar Double buffering Drawing with transformations Drawing an analog clock When you right-click the … Continue reading

Posted in animation, drawing, forms, graphics | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

Animate a piston driving a wheel in C#

This example draws a piston that powers a rotating wheel. The program uses a timer to move the piston. The following code shows the timer’s Tick event handler. // Move the piston. private void tmrMovePiston_Tick(object sender, EventArgs e) { X … Continue reading

Posted in algorithms, animation, drawing, graphics, multimedia | Tagged , , , , , , , , , , , , | Leave a comment

Animate two rods connected to a wheel in C#

This example draws two rods and a wheel. One rod is connected to the other and to a wheel. The second rod is connected to the first and is anchored in the middle. (I made this project because I wanted … Continue reading

Posted in algorithms, animation, graphics, mathematics | Tagged , , , , , , , , , , , | Leave a comment

Make animated labels in C#

This example shows how to make animated labels that slowly move into position to make an interesting “movie credit” effect. Note that the example’s result is better than the result giving by the GIF on the right. The GIF is … Continue reading

Posted in animation, graphics, multimedia | Tagged , , , , , , , , , , , , | 1 Comment

Draw animated text in C#

Note that the result in the executable is better than the result giving by the GIF on the right. The GIF is a bit jerky because it uses only 20 frames instead of the 200 used by the program. This … Continue reading

Posted in animation, fonts, graphics, multimedia | Tagged , , , , , , , , , , , | Leave a comment

Animate the Tower of Hanoi problem in C#

This example is similar to the example Recursively solve the Tower of Hanoi problem in C# except it uses animation to show how the disks move from one peg to another. The following AnimateMovement method moves a disk in a … Continue reading

Posted in algorithms, animation, drawing, graphics, multimedia, recursion | Tagged , , , , , , , , , , , , , , , , | Leave a comment