create a 2-D or 3-D animation on one parameter
animate(plotcommand, plotargs, t=a..b, options)
animate(plotcommand, plotargs, t=L, options)
Maple procedure that generates a 2-D or 3-D plot
list of arguments to the plot command
name of parameter on which the animation is made
real constants giving the range of the animation
list of values
(optional) equation(s) of the form option=value; specify options for the animate command or the plot command
background : color, image; accepts a color or image as the background of the animation. The default is NULL.
digits : posint; specifies the number of decimal digits for the parameter value. The default is 5.
frames : posint; specifies the number of frames in the animation. The default is 25.
paraminfo : truefalse; generates the parameter value in the title for each frame. The default is true.
trace : nonnegint; the number of previous frames to be kept in the animation. The default is 0, meaning that no trace is shown.
The animate command can be used to generate an animation on one parameter for any Maple plot command, both 2-D and 3-D. For example, the following generates an animation of the sine curve A⁢sin⁡x on the amplitude A.
plots[animate]( plot, [A*sin(x), x=0..10], A=0..2 );
This command creates an animation with 25 frames.
To run the animation using the worksheet interface:
Click the plot. The plot toolbar is displayed.
In the toolbar, click the Play button.
Alternatively, right-click (Control-click, on Mac) the plot to display the context menu. Select Animation > Play.
In the first calling sequence, an animation with 25 frames is created for 25 equally spaced real values of the animation parameter A on the range a..b. In the second calling sequence, the given list of values is used for frames of the animation.
The first input, plotcommand is the Maple plotting command. It must return a Maple 2-D or 3-D plot. The second input, plotargs, is a list of arguments for plotcommand. To plot the sine function for two different frequencies, you can use:
plot( sin(2*x), x=-Pi..Pi, thickness=2 );
plot( sin(3*x), x=-Pi..Pi, thickness=2 );
To convert this to an animation on the frequency, put the above arguments to the plot command in a list as follows.
plots[animate]( plot, [sin(A*x), x=-Pi..Pi, thickness=2], A=1..5 );
To animate a curve being traced out in time, make the domain parameter(s), x in the above example, depend on the animation parameter. For example, here is a sine curve being traced out in time t.
plots[animate]( plot, [sin(t), t=0..x], x=0..4*Pi );
Animations in 3-D are similarly obtained. For example:
plots[animate]( plot3d, [sin(A)*(x^2+y^2), x=-2..2, y=-2..2], A=0..2*Pi );
The remaining arguments to the animate command are interpreted as options. They are equations of the form option=value. The options described below are specific to the animate command. Other options, such as scaling=constrained, are passed on the to plots[display] command.
By default, the animate command generates 25 frames equally spaced on the animation parameter interval A=a..b. The optional argument frames=n specifies that the animation is to have n frames.
By default, the numerical value of the animation parameter A is displayed to 5 significant digits for each frame in the animation in the title region of the plot. The optional argument paraminfo=false turns this information off. The optional argument digits=n can be used to display a different number of significant digits.
The background=p option accepts a color or image as the background of the animation, as described in the plot/options help page. With the animate command, additional values for p are allowed. The value of p can be a PLOT or PLOT3D object (the output of a 2-D or 3-D plotting command) or a list of such objects. In the latter case, the plots[display] command will be called to combine the plot structures into a single background plot. The value of p can also be a numerical value, in which case the plot generated by plotcommand for A=p is used for the background.
The trace=n option specifies that a trace of frames specified by n be displayed, where n is a positive integer or a list of positive integers. When n is an integer, then n frames, equally-spaced in the animation range, will be display in all frames after their initial display. Thus, the final frame of the animation displays n+1 frames. For example, if the number of frames is 25 and n=5, then frames 1, 6, 11, 15, and 20 display in subsequent frames. When n is a list of integers, then the frames in those positions are the ones included in the trace. Each integer in n must be no larger than the maximum number of frames. The default is n=0, that is, no trace is shown.
If each frame in the animation must contain two or more different plots, write a Maple procedure that creates each frame and animate that procedure. See the last example in the Examples section below.
To construct an animation sequence from existing plots, use the plots[display] function with the insequence option. This is what the animate command does.
For information on viewing animations, see Overview of Animation Menu.
Note: You can save animations as an animated GIF file. For more information on producing GIF files, see plot/device.
To play an animation in this help page, right-click (Control-click, on Mac) the plot to display the context menu. Select Animation > Play.
The first few examples are for animating a curve or surface on a parameter.
The next example shows how to do this in 3 dimensions.
The next examples are of a circle and a hyperbola given implicitly as an equation. See the plots[implicitplot3d] command to generalize these to 3 dimensions.
The next few examples are for animating a curve in 2 or 3 dimensions in time. Here is a sine wave and a damped sine wave animated in time.
The following is a circle traced out using its trigonometric parametrization and its rational parametrization. The latter does not result in a uniform motion.
Here is a curve in 3-D space defined parametrically.
opts ≔ thickness=5,numpoints=100,color=black:
The following example has a surface as the background and a curve traced on the surface. The background frame is a 3-D plot of the surface. The curve is a heavy black line.
B ≔ plot3d⁡1−x2−y2,x=−1..1,y=−1..1,style=patchcontour:
opts ≔ thickness=5,color=black:
The remaining examples show animations of objects in time. The first is an illustration of simple harmonic motion. We show a blue ball moving up and down in two dimensions. In the example, each frame is defined by a Maple procedure ball.
ball := proc(x,y) plots[pointplot]([[x,y]],color=blue,symbol=solidcircle,symbolsize=40) end proc:
To roll the ball along the sine wave, make the sine wave the background frame and animate a ball along it, or leave a trace of the ball.
sinewave ≔ plot⁡sin⁡x,x=0..4⁢Pi:
This final example contains several objects in the animation.
F := proc(t)
plottools[line]([-2,0], [cos(t)-2, sin(t)], color=blue),
plottools[line]([cos(t)-2, sin(t)], [t, sin(t)], color=blue),
plot(sin(x), x=0..t, view=[-3..7, -5..5])
Overview of Animation Menu
Download Help Document
What kind of issue would you like to report? (Optional)