A freely oscillating object oscillates with constant amplitude as there are no frictional forces acting upon it. The only force acting on it is the restoring force.Consider the transfers of energy of a simple pendulum.At the highest point, the kinetic energy is zero as the velocity is zero and the gravitational potential energy is a maximum.At the lowest point (equilibrium position) all the gravitational potential energy has been transferred to kinetic energy.As it rises, the kinetic energy is transferred to gravitational potential energy again.Using EP = ½kA2 where k is the spring constant and the amplitude A has been substituted for x, the kinetic energy is given byEk=Etotal - EP = ½mv2
therefore: Ek=½k(A2 - x2) 
therefore: