Whether it's a pendulum, a mass on a spring or an electrical oscillator, an oscillating system can be described in terms of energy changing from one form to another.
When a pendulum is released, EP is converted to EK as it swings to the lowest point. On the way back up the other side EK is converted back to EP. EP is again converted to EK and back to EP on the swing back.
Energy is constantly changing from EP to EK and back but the total is always the same.
Energy changes in a mass on a spring - this time with extra gravity!
A mass oscillating on a spring in a gravitational field is complicated by the fact that there are two components of potential energy, gravitational and elastic.
NB: The overall oscillating energy graph looks identical as the equilibrium position shifts, but oscillations still occur symmetrically around this.
Use quizzes to practise application of theory.