EZ Math Movie, Tutorials, Input and Output, The Output Gizmo


What these look like

The output gizmo

The output gizmo shows you a value.

An output gizmo lets you see the current value of a variable while your program is animating. You can think of it as a tiny printer, if you like, upon which you show the current value of a variable.

Like input gizmos, output gizmos have a name that functions as a description of the value being displayed. This name has no technical connection with any variable name, but since an output gizmo is often used to present the value of a variable, it often has a similar, or identical, name to that variable.

The parts of the output gizmo

Output gizmo explanation

The label and name

The labels for the output gizmos are '1st Output', '2nd Output', and so on. The output gizmo's label is used to reference it from within your program code. For example, if you want to show a variable's value through the 1st output gizmo, then in your code you would use the set1stOutputValue command. You can not change the label for an output gizmo.

The name on an output gizmo is used to describe the meaning the output. The name defaults to 'Name', but you can change that. If you want to use an output gizmo to show the radius of a circle, then you might rename it 'Radius'. Understand that this is not hard wired to the name of a variable. There is actually no connection between the name of an output gizmo and the name of a variable except, sometimes, in our minds. Do not think that simply naming an output gizmo the same as the name of a variable within your program code will cause the value of that variable to be shown through the output gizmo. There is no automatic connection of this type. You need to use commands like set1stOutputValue to make that connection. The name of the output gizmo reminds us of its meaning; it is a description of the number being output. It's just a sign, though, and technically not a variable's name.

Changing the name

Changing the output name

Running the example program

The example program demonstrates a classic EZ Math Movie animation form. A shape, a simple point in this case, is moved back and forth across the graph. The repeating loop code section does the following:

More about running the example program

Using output gizmos is handy, but it will slow your program down a bit. As it turns out, it takes some computing time to get a value out of your code and on to the screen. You can experiment with this effect by changing one line of code. Find this line in the loop code section:

set1stOutputValue(x);

This is the code that sends the value of the variable x to the 1st output gizmo. Turn it into a comment by placing two slashes at its start, like this:

//set1stOutputValue(x);

Now the line will be ignored by the computer, and you can see if the program animates any quicker. Run the program again with this line 'commented out'. On many computers the point will move a bit faster and smoother. So, the output gizmo is very handy, but it may slow down the performance somewhat.


The example program

0ptions
Angle measurement: Degrees Radians

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide


		

	


		

	


		

	

And....

Next tutorial: Rectangle area


All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.



Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com




EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com



Custom Search

Name:
Domain:

Name
0


Name:
Name
0