The Parrot is built from the Lego Wedo 2.0 educational kit. The movement occurs due to the operation of a spur gear transmission (reducing in type). In order for the parrot to start swinging on the perch, you need to pull your hand towards it, which will trigger the distance sensor and start the program.
The set includes step-by-step building instruction and an example of program (in Lego Wedo 2.0 environment).