Graphics Programs Reference
In-Depth Information
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// draw the front plane
lineStyle (2, 0x0000ff, 100);
moveTo (xs[0], ys[0]);
for (i = 1; i < numPts/2; i++)
{
lineTo (xs[i], ys[i]);
}
lineTo (xs[0], ys[0]);
// draw the back plane
lineStyle (2, 0xcc0000, 100);
moveTo (xs[numPts/2], ys[numPts/2]);
for (i = numPts/2+1; i < numPts; i++)
{
lineTo (xs[i], ys[i]);
}
lineTo (xs[numPts/2], ys[numPts/2]);
// draw the connecting lines
lineStyle (2, 0xaa00aa, 100);
for ( n = 0; n < numPts/2; n++ )
{
moveTo (xs[n], ys[n]);
lineTo (xs[n+numPts/2], ys[n+numPts/2]);
}
The back plane is handled in a similar manner. Let's set the drawing color to red so
that we can differentiate the back plane from the front plane (line 198). Next, we move
to the first point of the back plane (line 199). To draw the back plane, we must loop
over the second half of the total number of points (line 200). As before, the lineTo()
method connects the points of the back plane with the exception of the initial point (line
202). A separate lineTo() connects the last point of the back plane to the first point
(line 204).
We'll use a violet color to draw the connecting lines from the front plane to the back
plane (line 207). Since each face has numPts/2 points, we can set up a loop that starts
from each point on the front plane (line 210) and connects to its corresponding point on
the back plane (line 211).
Save your movie as 9_2_extrusionDONE.fla . Make sure that all of the points are
connected properly. This completes the exercise.
Search WWH ::




Custom Search