What this simulation shows
A glider rests on a level air track, held up on a cushion of air so that friction is negligible. A spring joins it to a fixed block. When the spring is at its natural length the glider sits at the equilibrium position, marked by the dashed line. Pull it out and let go, and it oscillates: out past the line, back, and round again. A pen on the glider marks a paper strip that runs downwards beneath it, so the trace is a displacement–time graph with the most recent moment at the top.
The sim times every complete oscillation for you, from one end of the swing back to the same end, and lists the results under Timed oscillations. The Period card shows the latest of them and the Frequency card shows how many oscillations that rate gives per second.
Energy moving between stores
At the end of a swing the glider is still for an instant and the stretched spring holds all of the energy. As the spring pulls it back towards the middle, that energy moves into the glider's kinetic store. Crossing the dashed line, the spring is neither stretched nor squashed, so it stores nothing and the glider moves at its top speed. Beyond the line the spring is compressed and slows the glider until it stops at the other end with the energy back in the spring. This exchange happens twice in each oscillation. Without damping the kinetic and elastic bars always add up to the energy you gave the spring when you pulled the glider out.
What sets the period
Change the mass and the period changes, but not in proportion: four times the mass doubles it. A heavier glider responds more sluggishly to the same pull, so it takes longer to get anywhere. A stiffer spring pulls harder at every displacement and shortens the period. When the spring follows Hooke's law, the period works out as
What does not appear is just as useful. The pull-out distance has no effect: twice as far out means twice the force, twice the speed and twice the distance, and the timing comes out the same. Gravity is missing too, since the track supports the glider's weight.
Damping
Choose a damping setting and a vane on the glider dips into a trough of liquid. The drag on the vane takes some energy away on every swing and passes it to the liquid, so the thermal bar grows while the other two shrink. The trace narrows as the amplitude falls, yet the timed oscillations barely change. With the starting glider and spring, strong damping makes each one only about one per cent longer, and the motion dies away within a handful of oscillations.
Simplifications and course notes
The spring has no mass, never passes its limit of proportionality and acts only along the track. The air track is treated as perfectly frictionless, and the drag in the liquid is taken to be proportional to speed. The motion is calculated from Newton's second law exactly rather than in small steps.
Punjab Class 9, Cambridge IGCSE and AQA GCSE all cover Hooke's law, kinetic energy and the elastic store, and AQA adds ½ke² for the energy a stretched spring holds. Period and frequency come up with waves, in AQA GCSE and in Punjab Class 10. The formula for the period and the idea of damping go beyond all three courses; the formula usually comes later, for example at A-level.