How to achieve gimbal lock with Euler angles? I was studying about Euler angles and I came across the problem gimbal lock which can occur by using Euler angles. In gimbal lock we lose one axis of rotation. 

But how? And when does it happen? On what conditions? 

All I know about Euler angles is that rotation always occurs about the object axes not upright axes (axes whose orientation is always the same as the world axes). And the object axes will remain perpendicular to each other in each rotation. 

Could someone use Euler angles and show me how to get to that point of gimbal lock?

How can it affect animations?
Rotations in 3D are normally done with matrices. The xyz Euler angles can be converted to matrices so that it can be used in the rotation.
That is where something called rotation order comes in.
Basically it says in what order you rotate the object.
First you rotate the object around the x axis, then the y axis and lastly the z axis for example.

This means that when you rotate the object around the x axis first, you change the way the y axis and z axis rotate.
Of course this changes depending on the rotation order.

This GIF shows how changing one axis value can change the others, but it doesn't work that way for everything.



Here you can also see at the end that I add in that gimbal lock.
This is where I lose one axis of rotation.

This could be fixed by changing the rotation order to an order, where it doesn't break the way it should work.
It could also be fixed by not using Euler angles but Euler angles are handy and simple in 3D animation.

In 3D animation it could lead to weird rotations since the values of the rotations have to be changed a lot to get a certain rotation that you want.
If you would look at the xyz Euler angle values in a graph, you would see spikes because of that.
This could lead to weird interpolation of the keyframes and a weird end result.

If you would like to read more about the math behind it, I would recommend reading about rotation matrices in 3D.
https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations

A little extra explanation for the animation:
Rotation in this case is around axis (shown as circles) and by rotating on one axis, you rotate the other axis. The consequence is that with a normal rotation sphere (the sphere in the animation, but then without the axis being rotated) in the animation, you don't see these axis being rotated. If you get a gimbal lock, one axis is the same as another one, but with a normal rotation sphere it still tries to rotate as if that axis wasn't the same as another one, this means that it uses weird values to get to that rotation and this can make an animation look weird.

I hope this helps!