MonsterStudios, a partner with MonsterWeb (the unlimited web hosting people), has recently published an animated commercial (completed entirely with Blender) for use on the MonsterWeb site (it's on the main page).
After MonsterStudios was done and we got a look at it, I was interested with what method he used to do the box flap animation. MonsterStudios was more than happy to share it's secrets with the Blender Community, so Daniel LaBarge, a MonsterWeb employee, gave a quick tutorial on how the box animation was done.
*Edit: After some comments I added more to the tutorial to (hopefully) make it more clear. I would also like to warn everyone that this is not a "beginner tutorial" since it goes over major concepts rather quickly. But if you have a question - post it!
Creating an Animated Box
Step 1: The first step to creating an animated box is adding a cube (Spacebar > Add > Mesh > Cube). After you create the mesh, you wil be in Edit mode. As you see in the below top image you will need to be in "face select mode" which you can enter by clicking the hollow triangle on the far right of the toolbar (or by using Ctrl + Tab > Faces). Select the top face and hit the X Key to delete it. You should then have a cube with the top missing as seen in the below bottom image.
Step 2: Go to the top view by hitting the 7 Key on the number pad. Enter Edge Edit Mode (Ctrl+Tab > Edges). Then select each of the top four edges (as seen being done in the top image below - here I am in the middle of extruding the bottom flap) and extrude them along the horizon out approximately half the width of the box (1.0 units). You can get straight flaps by holding down the Ctrl Key to snap to the grid. You should now have a hollow box with four flaps (in the image below bottom I have left the top view to show you what you should end up with.
Step 2a (Optional): If you would like to go a little futher, you can add depth to the paper thin box select the faces of the box flaps and scale them a very small amount (the box in the MonsterWeb has depth added throughout the box, but the just doing the flaps will be fine for now). Next we need to add an armature.
Step 3: In top view (7 Key on the number pad) add an armature at the center of the box along the flap horizon (Spacebar > Add > Armature).
Create a bone for each flap by placing the root of the bone at the bottom of the flap near the middle of the flap and the top of the bone at the top of the flap near the middle of the flap. Once the armature is created and a bone appears, it and each subsequent bone you create from Add > Bone (see the image below), you will need to selct the bone and move it into position. Using the Ctrl Key to snap to the grip really helps in placing these. Be sure to keep the center of the armature in the same place while moving the bones around (which shouldn't be a problem if all you select is the bones. Give each bone an unique name so that it's easy to identify when adding vertex groups.
Step 4: After adding the four bones in top view, leave the top view and check your work. You'll notice that the armature (all the bones) are not on the flaps but below them. To get them aligned you will need to move the armature up to the flaps. To ensure I get the whole armature and not just one or two of the bones, I selected the armature in the Outliner window. To get an Outliner window split the viewport and switch one of the windows to the Outliner view. When in the Outliner view go to View > Show Outliner. This is seen in the image below:
I then used the Grab widget (Ctrl + Alt + G Key) and used the arrows to grab the armature and move it up to the box flaps (again using the Ctrl Key to sanp to the grid). See below for the final result:
I also like switching to Stick armatures for this kind of a rig. You can change how the bones look by going to the Armature box when you selct the armature or bone in edit mode (see below for the Armature box with the "stick" view selected).
Step 5: Next step is to parent the box to the armature without applying vertex groups (Select the box > select the armature > then Ctrl+P Key > Armature > Don't create groups).
Now select the box and enter edit mode. Select each outer vertices of each flap and in the Edit Buttons (F9) create a new Vertex Group (where the word "Group" is highlighted in the image below) called the same name as the bone that the flap edge corresponds to. Then with those vertices selected, click Assign to tell Blender to assign the vertex group to the bone (for example the vertex group "top" with the bone named "top").
Step 6: Exit edit mode and select the armature and enter pose mode (Ctrl+Tab). Select a bone and rotate it. If all goes right you should now have the outer edge parented to a single bone and when the bone rotates, the flap should open and close. Ctrl + Z Key to undo the test rotation you just did.
Step 7: In order to animate the box flaps you will need to first split the window and open an IPO view (see the image below). Make each window use the "Pose mode" which you can see in the image below with a yellow circle next to the name. I like using the rotation widget (Ctrl + Alt + R Key) for this kind of rotation because it offers more control.
So with a bone selected, use the widget to control the rotation in a single direction in the position at each frame you want it (I use the IPO window to slide to the frame I want to use). When you have selected the frame you like, in the 3D view window that shows the bone and box hit the I Key and insert a Rotation key (as demonstrated in the below image). This will ad the key to the IPO window at the desired frame. It will also add keys for rotation directions you do not use (they will look like horizontal lines in the IPO window). In the example image below I removed the other rotation keys we do not need.
Some animating tips: When using the IPO window to manipulate keys, most of the commands are the same you will find in the main 3D window (e.g. G Key for grab, A Key to select all the keys, right click to selct, etc). To make it realistic open each flap slightly after each other with the bottom flaps opening last. Also box flaps don't usually open linearly so give them a sudden spring and then a recoil and bounce as they fall to the sides!
Confused by all the key strokes? Worried you won't remember them? Then the Hotkey map is something you shouldn't be without.
MonsterWeb and MonsterStudios would like to take the opportunity to say thank you to the Blender Community and the Blender Foundation for creating such an amazing software and for offering it to the world for FREE!