Using Terminal to Take Screenshots

So I sometimes use the Terminal to take many screenshots in rapid succession. Since I have an interest in animation, I sometimes use this to capture and examine how other animators have drawn certain movements. To take my screenshots, I made a script (at least I think it's a script) with the following code:

screencapture -T .04 ~/Desktop/screenshot0.jpg;
screencapture -T .04 ~/Desktop/screenshot1.jpg;
screencapture -T .04 ~/Desktop/screenshot2.jpg;
screencapture -T .04 ~/Desktop/screenshot3.jpg;
screencapture -T .04 ~/Desktop/screenshot4.jpg;
screencapture -T .04 ~/Desktop/screenshot4.jpg;
screencapture -T .04 ~/Desktop/screenshot4.jpg;
screencapture -T .04 ~/Desktop/screenshot5.jpg;
screencapture -T .04 ~/Desktop/screenshot6.jpg;
screencapture -T .04 ~/Desktop/screenshot7.jpg;
screencapture -T .04 ~/Desktop/screenshot8.jpg;
screencapture -T .04 ~/Desktop/screenshot9.jpg;
screencapture -T .04 ~/Desktop/screenshot10.jpg;
screencapture -T .04 ~/Desktop/screenshot11.jpg;
screencapture -T .04 ~/Desktop/screenshot12.jpg;
screencapture -T .04 ~/Desktop/screenshot13.jpg;
screencapture -T .04 ~/Desktop/screenshot14.jpg;
screencapture -T .04 ~/Desktop/screenshot15.jpg;
screencapture -T .04 ~/Desktop/screenshot16.jpg;
screencapture -T .04 ~/Desktop/screenshot17.jpg;
screencapture -T .04 ~/Desktop/screenshot18.jpg;
screencapture -T .04 ~/Desktop/screenshot19.jpg;
screencapture -T .04 ~/Desktop/screenshot20.jpg;
screencapture -T .04 ~/Desktop/screenshot21.jpg;
screencapture -T .04 ~/Desktop/screenshot22.jpg;
screencapture -T .04 ~/Desktop/screenshot23.jpg;
screencapture -T .04 ~/Desktop/screenshot24.jpg;
screencapture -T .04 ~/Desktop/screenshot25.jpg;
screencapture -T .04 ~/Desktop/screenshot26.jpg;
screencapture -T .04 ~/Desktop/screenshot27.jpg;
screencapture -T .04 ~/Desktop/screenshot28.jpg;
screencapture -T .04 ~/Desktop/screenshot29.jpg;
screencapture -T .04 ~/Desktop/screenshot30.jpg

This should, in theory, take 30 screenshots in 1.5 seconds. In practice, my computer can't handle this either a) because it simply to much of a burden to capture so many images in 1.5 seconds, or b) because I haven't actually effectively told my computer what I want it to do. Right now, my computer takes the thirty screenshots over the course of about 5 or 6 seconds. For the purposes of capturing an animated movement, this is too slow.

Can anyone help me get my computer to do what I want it to do?

I don't know the true reason but talking about script, you execute 30 times the same command line... that can be put in a script in two different ways:
Either you use a loop with a counter or
you use a loop with something that allow you to quit.

e.g. with counter:

#!/bin/ksh
i=0
while [ "$i" -le 30 ]
do
 screencapture -T .04 ~/Desktop/screenshot$i.jpg
 sleep 2
 let i=i+1
done

Consider the concept of Stop Motion animation. You don't need to capture in real time, but you do need to play back in real time. Choose the resolution of your images to match the capabilities of you computer on playback.

So I've changed the script to be more or less what vbe recommended. With regard to methyl, that's a fantastic idea! But how do I adjust the resolution of the screenshots? I read the manual entry of screencapture, but I didn't see a way to adjust picture quality.

I'm assuming that your shell is bash. Does this help?

for i in {0..29}
do
    screencapture -x -T 0 -t tiff screenshot"$i".tiff
done