The equation of a simple harmonic motion is:
where x is the displacement, A is the amplitude of oscillation, f is the frequency,is the elapsed time, and f is the phase of oscillation.
To create a simple model of simple harmonic motion in VB6 , use the equation x=Acos(wt), and assign a value of 500 to A and a value of 50 to w.
In this program, you have to insert a shape and set it to be a circle in the properties windows. Next, insert two command buttons and change the captions to start and stop respectively. Finally, insert a timer and set its interval to be 1000 and disabled it at start up. We can use the move method to move the shape1 object whose path is determined by the formula x = 500 * Cos(50 * t) . When you run the program, the will move in an oscillating motion as shown in the figure below: