Creating hourglass animation

Start by creating an hourglass from the custom shape tool.

Using direct selection tool select the hourglass inner path. Select the node shown in the image and drag downwards.
Select the white shapes in the lower half of the hourglass using direct selection tool. Press delete.
Copy the white shape from the upper half. Enable subtract from shape area from the top bar and press Ctrl+V to paste.
Move the path downwards and place as shown in the image.

Create sand area using pen tool. Move this layer below the hour glass layer in layer window.

Press Q to enable quick masking. From filter menu select noise>>add noise. Apply settings as shown.
Press Q again to disable quick masking.
Press delete to remove the selection.
Duplicate the layer. Press Ctrl+T. Right click the layer and select flip vertical. Place as shown in the image.
Create a thin fine slit in the bottle neck area using rectangular shape tool.
Select the upper sand layer. From layer window click on add layer mask button.

Create a rectangular selection using rectangular marquee tool.

Press Ctrl+Alt+D to feather the selection.

 

Fill with black color.
Unlink the mask thumbnail in layer window. Move the mask upwards.
Repeat above mentioned step for lower sand layer with an exception that you don't have to move this layer.
Create a fine slit with same color that you use for sand to show the downwards stream of sand. Create a mask for the stream as you did for the sand layer.
Open animation window.
Duplicate frame. Move the mask of sand stream downwards.
For the same frame, move the mask of upper sand layer downwards and mask of lower sand layer upwards.
Duplicate frame. Move the mask of upper sand layer downwards so that it covers the upper sand layer completely. and mask of lower sand layer upwards so that it uncovers the lower sand layer completely. Also move the mask of sand stream so that it covers the stream completely.
Select the second frame. Press tween button in animation window.

Apply settings as shown.
Select the last frame. Press tween button in animation window. Apply settings like previous step.
Press Ctrl+Alt+Shift+S to save an optimized animated GIF.