Animating piano keys and musical notes

Start by opening a close-up of piano keys.

Create piano's key selection using polygon lasso tool.

Press Ctrl+Shift+J to copy paste the selection in a new layer. Double click the layer to open layer style window. Apply layer style with the settings shown.
Similarly knock out more keys in separate layer and also copy paste the layer style to make an impression of pressed key.

Create a selection of black key.

Press Ctrl+J to duplicate the layer. Press Ctrl+T. Right click the layer and select warp. Adjust nodes to get the shape as shown.
Create a line using line shape tool.
Duplicate the layer and place as shown in the image below.

 

Select and merge all the line layers. From filter menu select distort>>wave. Apply settings as shown.
Using custom shape tool create some musical note shapes.
Place them as shown in the image below.
Merge the line wave layer with musical notes layer. Create two duplicate layers. Move one to the right and other to the left. This is to ensure that we get a seamless loop of musical notes animation. Merge these three layers.
Open animation window. For the first frame keep all the pressed key layers hidden.
Duplicate frame. Move the musical notes layer towards left.
Press Tween button in animation window. Apply settings as shown.
Delete the last frame.
Now keep selecting frames starting from the 2nd frame and keep unhiding the pressed key layer one by one.
Press Ctrl+Alt+Shift+S to save an optimized animated GIF.