Animated Vector Graphics on an Oscilloscope
I lost the original edit to this post. Recreated.
So, while watching the Oscars, I decided to hack together a simple little graphics program that would allow me to generate more sophisticated graphics for the oscilloscope. I ended up with 263 lines of code that implemented a simple matrix-based set of graphics commands. Eventually, I’ll add some line clipping and some other graphics primitives, but for now, it seems to be working just fine.
YouTube – Animated Vector Graphics on an Oscilloscope
To give you a taste of what the library lets you do, here is the set of commands that I used to generate the animated dial you see in the film.
[sourcecode lang=”C”]
void
Dial(double seconds)
{
int i ;
TransformPush() ;
fprintf(stderr, "… angle %lf\n", seconds6.) ;
Rotate(seconds6.) ;
Line(0.0, 1., -0.05, -0.05) ;
Line(-0.05, -0.05, 0.05, -0.05) ;
Line(0.05, -0.05, 0., 1.0) ;
TransformPop() ;
for (i=0; i<360; i+= 6) {
TransformPush() ;
Rotate((double) i) ;
if ((i % 30) == 0)
Line(1.0, 0., 0.90, 0.) ;
else
Line(1.0, 0., 0.95, 0.) ;
TransformPop() ;
}
}
[/sourcecode]
Addendum: Congrats to Lee and all the Toy Story 3 crew, and to Randy for winning his second Oscar (with twenty nominations, incredible). He definitely has had the best speech of the night so far.