Task 083: Animation using Circles and Discs

Devise and implement an animation that is drawn using via circles and discs. The animations must be computed frame by frame ("off-line rendering"), which are later combined into an actual movie, e.g. via the ffmpeg application.



The template application 083animation from the repository grcis serves as the basis of this project. It is a simple application that repeatedly runs your method Animation.DrawFrame() and writes the results to individual PNG files. The calculation is done in a separate thread so that it can, if necessary, be interrupted via the Stop button.

Possible Themes

For instance, move or change a shape in the plane. A 3D effect you would have to handle yourself, e.g. by drawing back-to-front (i.e. via the painter's algorithm). There are no limits on your imagination, you only have to draw the animations frames, finish your program and only use the class Canvas. This means that apart from the movie generation/encoding tools, no other tools may be used.


The images must be generated via the Canvas class, which has the following API (identical to that in assignment 082):

  • int Width - width of the generated image (after setting/modifying this, you have to call Clear()).
  • int Height - height of the generated image (after setting/modifying this, you have to call Clear()).
  • Clear ( Color bg ) - initialises the image, set the background color bg.
  • SetColor ( Color col ) - sets the drawing colour.
  • SetAntiAlias ( bool aa ) - activate/deactivate anti-aliasing.
  • FillDisk ( float x, float y, float r ) - draws a disc of radius r, centered on [x,y] in the current drawing colour.

Technical details

The method Animation.DrawFrame() is handed data on the current time (see the reference implementation) and a reference to the Drawing Canvas object. The method also has access to data that defines the image size.

You can not assume anything about the order in which individual frames of the animation are rendered. Individual threads can draw images in any order. At the beginning of calculating the animation (or before each picture) your method Animation.InitAnimation() is executed: there, you can put any initialisation of global shared data, and suchlike. If you need to perform a comprehensive calculation (physical / mechanical simulation, etc.), you must also run InitAnimation().

Initialisation of parameters: in order to have all relevant code nicely grouped in a single location, you can initialise your application parameters in the function InitParams(). It is called during application start-up.

Production of the video file

See e.g. this manual. ffmpeg binaries for Windows can be downloaded from here. The generated video can be uploaded to YouTube: send us the link to the video once you are done with that! And do not forget to attach the source file Animation.cs.


Hand in the assignment until: 6. 1. 2019


Basic: 5 to 20 points, depending on difficulty and attractiveness of the solution.
Bonus: for exceptional solutions


Visual Studio project: 083animation

Source file

Modify and hand in the source file: Animation.cs
As a comment in the first line, please include your name!
Do not forget to send a link to your video!


Please vote in the contest before 23. 1. 2019.

Copyright (C) 2015-2019 J. Pelikán & A. Wilkie, last change: 2022-11-12 12:14:00 +0100 (Sat, 12 Nov 2022)