This small 2D animation was creating during my Introduction to Computer Graphics course. This was my first graphical coding assignment ever undertaken and I think it turned out rather well. The coding could have been better, but the desired end result was achieved.
The entire animation and all of its individual frames were creating by coding in C. Each star point was defined in a 3D array (the third being to define the colour), and then lines were automatically created between each of the points by using the DDA Line Algorithm. The Boundary Fill Algorithm was used to colour in the star. Once all this was done, each point is rotated a certain degree, and then each calculation was done again. The flashing stars were made by moving the endpoints back and forth depending on the frame number.
This was repeated 30 times and then each frame outputted as a Plain ppm (P3) file. Once all the frames were successully created, the Unix utility 'ppmtompeg' was used to create the mpg file itself.
Download the 2D Rotating Star.
This small 3D animation was also created during my Introduction to Computer Graphics course. After creating the 2D animation, the next logical step was to 3D, and here it is. The animation shows the four innermost planets rotating around the teapot sun. All planets are actually in correct ratio with eachother in terms of size, orbit length and distance from the sun.
The animation was created using GLUT and coding in C++. The coding was somewhat similar to the star, in that, after each pass the planets new location was calculated depending on its current location and how fast its orbit rotation is. Perhaps the most difficult part in coding this was making sure that each planet was of correct size and that its orbit rotation was correct. Working with OpenGL and GLUT for the first time was also challenging as I slowly worked out how to correctly use it.
The rotation of the teapot was actually quite simple. It is basically rotating by itself on each pass, and when one of the arrow keys are pressed, the angle is slighlty incremented, thus changing the rotation. This is also the case for the colouring of the teapot, a standard colour, which is then slightly changed when one of the mouse buttons are pressed.
This was actually my first ever coding in C++ and I had never really been exposed to it before. That is why, the code itself leans more towards C than C++, in that there isn't really any classes being used in this project. Perhaps if I were to do this again, the coding would be much more efficient. Either way, the end result is what I wanted, and I achieved a mark which I thought was deserving of the effort.