Notes:
We've got our eye on you! Many novice designs required eyes so we made a function for them! We were motivated to make this function so we could use it in the development of our TNTGhost.
In this development, we also created a member function of TNTEye (yes, a 'method'), 'drawDuplicateAt', that allows us to make a duplicate of an existing eye in an offset location, making it easier to have a pair of eyes.
Click the 'Reload' button to watch the eye directions randomly move around the eye!
TNTEye Features and Usage:
| Primary Attributes: |
7 Parameters:
If you want to use the function 'drawDuplicateAt', just provide the x and y offsets you want in the call to the function. See the example notes below. |
|---|---|
| To Create: |
The example above was created by:
//head and mouth
var head = new TNTDisk(new TNTPoint(0, 2), 7, yellow, blackStroke);
head.drawTNTDisk(context);
var mouth = new TNTEllipse(new TNTPoint(2, -2), 4, 2, black, redStroke, 200, 30);
mouth.drawTNTEllipse(context);
//the 'base' of the eye, in this case, the whites of the eye
var eyeBase = new TNTDisk(new TNTPoint(-2,3), 2, white, blackStroke);
var eyeColors = new Array(white, black);
var eyeStrokes = new Array(lightGrayStroke, blueStroke);
var myEye1 = new TNTEye(eyeBase, .3, 1.2, true, false, 25, eyeColors, eyeStrokes);
myEye1.drawTNTEye(context);
myEye1.drawDuplicateAt(.25, 2);
|
| To Draw: |
myEye1.drawTNTEye(context); |
| Comments: |
Note that the base info provides the basic size and location of the eye. Thanks, encapsulation! |
