
|
Search
Search Journal of Online Mathematics and its Applications: |
Journal of Online Mathematics and its ApplicationsConstructing Mathlets Quickly using LiveGraphics3DAnimationsParametrized graphics can be very useful, but at times you might want certain graphics primitives to move in a prearranged fashion. LiveGraphics3D facilitates this by providing another format for its input. Instead of
Graphics3D[ primitives, options ]
we use the form
Animate[ Graphics3D[ primitives, options ], {t, tmin, tmax, tstep} ]
This is demonstrated in the following applet, which shows a very simple model of a solar system. The three points in the applet are located at
<html><body>
<applet archive="live.jar" code="Live.class" width="500" height="500">
<param name="INPUT"
value="Animate[
Graphics3D[{
RGBColor[ 1, .5, 0],PointSize[0.1], Point[{x0,y0,z0}],
RGBColor[ 0, 0, 1],PointSize[0.05],Point[{x1,y1,z1}],
RGBColor[.5, .5, .5],PointSize[0.03],Point[{x2,y2,z2}]},
PlotRange->{{-2,2}, {-2,2}, {-1,1}},
Axes -> True, AxesLabel -> {X, Y, Z}],
{t, 0, 6.2831, 0.1}]" />
<param name="INDEPENDENT_VARIABLES"
value="{t -> 0, x0 -> 0, y0 -> 0, z0 -> 0 }" />
<param name="DEPENDENT_VARIABLES" value="{
x0 -> If[ x0 < -2, -2, If[ x0 > 2, 2, x0 ]],
y0 -> If[ y0 < -2, -2, If[ y0 > 2, 2, y0 ]],
z0 -> If[ z0 < -1, -1, If[ z0 > 1, 1, z0 ]],
x1 -> x0 + 1.5*Cos[t],
y1 -> y0 + 1.5*Sin[t],
z1 -> z0,
x2 -> x1 + 0.5*Cos[3*t],
y2 -> y1 + 0.5*Sin[3*t],
z2 -> z1}" />
</applet>
</body></html>
Resulting Applet:
As you can verify, LiveGraphics3D still allows you to rotate or zoom in and out while the animation is running. It is also possible to combine animations and parametrized graphics. Notice that |