The Physics Department

Back Science Contents Index Home




Click animation to restart.

Click to see the animation code.

Mechanics

Waves

Light

Here's the code that runs the above animation.

You can change the code, if you like, and then click the following 'Reevaluate code' button. The program will then work as per your changes. Of course, your changes, especially random changes, can introduce errors, miscalculations, and browser crashes. If you need to get things back to their original condition, just reload this page using your browser's reload button.

The intention here is to conveniently show the inner workings of this program so that you understand how the diagram is drawn. Can you figure out how to make the animation run a one frame per second?

Click the 'Code' button again to close this section.

Welcome to the Physics Department of Zona Land Education. Here most of the material you will find relates to classical physics regarding motion and forces, to waves, and to light ray optics.

 

The above animation shows an object bouncing around within the bounds of a box. The animation is programed to mimic gravity, it is a projectile motion animation with no air resistance. Click the 'Code' button above it you want to study the JavaScript computer language code that drives this animation. This code demonstrates a substantive library of routines for HTML5 graphics, animation loops, and particle motion under the influence of forces. If you are learning to program and want some ideas about how to create an animation like this one, click the 'Code' button. Following is an explanation of this animation:

The animation is updated with a new frame at a regular frequency several times per second. So, the time interval between frames is constant. The frames click like a clock.

The black disk is the object, the black vertical and horizontal lines mark the x- and y-positions of the object respectively. Check that: The horizontal line, that is lined up like an x-axis, actually marks the y-position, or y-coordinate, of the object. And the vertical line might look like a y-axis, but its actually showing the x-position, or x-coordinate, of the object.

The gray trailing lines mark the last several positions of the object during the last several time intervals of the animation. Since the time intervals between the frames is constant, if the spacing between these trailing lines has been growing, then the speed of the object has been increasing, and if the spacing has been shrinking, then the speed has been decreasing.

Gravity is a force that acts vertically downward. That is, it pulls the object downward. The object accelerates downward due to the pull of gravity.

Note in the animation that when the object is moving downward the spacing in the horizontal (y-coordinate) trailing lines grows. This shows that the downward speed is increasing due to the downward pull of gravity.

Note that when the object is moving up the spacing between the horizontal trailing lines shrinks. This shows that the upward speed is decreasing due to the downward pull of gravity.

Note that the vertical (x-coordinate) trailing line spacing never changes. Since the vertical lines are always separated by the same distance, the horizontal speed of the object does not change. There is no horizontal acceleration. That makes sense, since there is no horizontal force. Gravity pulls vertically, not horizontally.

 

Back Science Contents Index Home



Custom Search