Maximum displacement

If a ruler is held on the edge of a desk and flicked so that it vibrates, like this.

At each end of the oscillation, when the displacement is at a maximum, the mass is momentarily still. It has zero kinetic energy but maximum potential energy.

In the case of a spring (pictured here) this potential energy is stored elastic energy. In the case of a pendulum it is gravitational potential energy.

SHM Energy at maximum displacement

Zero displacement

At the centre point of oscillation the speed of the mass is at a maximum. The kinetic energy is therefore at a maximum and the potential energy is zero.

A freely oscillating spring or pendulum loses energy very slowly. The energy converts from potential to kinetic and back in a continuous cycle; the total energy remains constant. (Law of conservation of energy)

SHM Energy at zero displacement