Notes:
A TNTOrb is like a sphere, built by a cluster of 'staged' TNTDisks, stacked via a loop that incrementally changes position and color using a linear transformation of each. Huh? Just look at the code! Note that even conical shapes are possible as well. Can you make some?
TNTOrb Features and Usage:
| Primary Attributes: |
3 Parameters: |
|---|---|
| To Create: |
The examples above were created by:
var smallCenter = new TNTPoint(3, 3);
var smallRadius = 1;
var smallDisk = new TNTDisk(smallCenter,
smallRadius, white, null);
var bigCenter = new TNTPoint(0, 0);
var bigRadius = 8;
var bigDisk = new TNTDisk(bigCenter,
bigRadius, lightGray, null);
var numSteps = 50;
//TNTGraphic Objects
var myOrb = new TNTOrb(bigDisk,
smallDisk, numSteps);
myOrb.drawTNTOrb(context);
//for ease, reusing variables here
//once they were used to create the
//first object
bigCenter = origin;
bigRadius = 2;
bigDisk = new TNTDisk(bigCenter,
bigRadius, orange, null);
smallCenter = new TNTPoint(-3, -3);
smallRadius = .5;
numSteps = 10;
smallDisk = new TNTDisk(smallCenter,
smallRadius, white, null);
var myCarrotNose = new TNTOrb(bigDisk,
smallDisk, numSteps);
myCarrotNose.drawTNTOrb(context);
|
| To Draw: | myOrb.drawTNTOrb(context); |
| Comments: |
It's interesting that such a complicated shape only needs 3 incredients. Part of the reason is the fact that each TNTDisk contains multiple pieces of information themselves. The 'myCarrotNose' orange shape shows what happens when the small disk is outside of the big disk. Also, the limited number of steps (10) lets you see how the evolving disks making up the shape lay up to make, in this case, a more conical shape. See the TNTOrb in action at this novice design: Elf in Living Room. |
