Category Archives: animation

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

Graph mosquito populations in C#

The example Simulate mosquito populations in C# simulates a mosquito population. This example draws a graph showing the population during each generation. When it calculates the populations for a new generation, it stores them in the following lists. // Data … Continue reading

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

Study WPF 3D performance in C#

The example Make a stellate geodesic sphere with WPF and C# makes a pretty complicated shape so I was wondering about the performance provided by WPF 3D programs. This example makes a group of stellate spheres using WPF 3D. See … Continue reading

Posted in animation, graphics, mathematics, performance, wpf | Tagged , , , , , , , , , , , , | 1 Comment