Notes:
An 'atomic' member of the JSGS family, TNTPoint is used in most other graphic elements. To create it, provide its x and y user coordinates. A call to the 'drawTNTPoint' function, as shown in the table, graphs it correctly in the canvas with the specified TNTColor (fcolr). To call it, say the object's name, followed by a period (aka the dot operator!) ending with 'drawTNTPoint' (with its parameters).
TNTPoint Features and Usage:
| Primary Attributes: | x and y coordinates, fcolr (a TNTColor, 'fill color') |
|---|---|
| To Create: | The example above was created by:
var ptA = new TNTPoint(-15, 3);
ptA.drawTNTPoint(myTNTCanvas, orange);
var ptB = new TNTPoint(5, 8);
ptB.setFactor(50);
ptB.drawTNTPoint(myTNTCanvas, blue);
var ptC = ptB.translate(3, 4);
ptC.drawTNTPoint(myTNTCanvas, medGreen);
//the code below shows that ptB was not modified by 'translate'
ptB.setFactor(100);
ptB.drawTNTPoint(myTNTCanvas, yellow);
|
| To Draw: | Use the 'drawTNTPoint' function as shown above. You need to supply the canvas (graph paper) and fill color as parameters (aka, ingredients). |
| Comments: | As shown in the tntGraphics specifications, TNTPoints may be translated, scaled, and their coordinates may be modified. Study the examples above to see how to translate and change the 'scaleFactor' of a TNTPoint. (Note: the larger the factor, the smaller the point!) |
| Even More: |
When drawing a TNTPoint, you have to provide both the canvas object (myTNTCanvas) as well as a fill color (a TNTColor). If you look at other shapes, it's enough to just supply the drawing function with a 'context'. TNTPoint is just a bit different from the others. Don't worry about it! A TNTPoint also has a 'member method' (aka function) that allows us to translate it to another location via provided 'deltaX' and 'deltaY' parameters. For example, a command like: Don't believe us? Check out the source code. |
