Previous Up Next

8.21.3  Animation of a sequence of graphic objects: animation

The animation command creates animations using sequences of graphic objects, which can be graphs (see Section 8.4) or not (see chapters 13 and 14). The sequence of objects depends most of the time on a parameter and is defined using the seq command but it is not mandatory. To define a sequence of graphic objects with seq, enter the definition of the graphic object (depending on the parameter), the parameter name, its minimum value, its maximum value maximum and optionally a step value.


Examples.


Remark: You can also define the sequence with a program. For example if you want to draw the segments of length 1,√2…√20 constructed with a right triangle of side 1 and the previous segment (note that there is a c:=evalf(..) statement to force approximate evaluation otherwise the computing time would be too long):
Input:

seg(n):={
local a,b,c,j,aa,bb,L;
a:=1;
b:=1;
L:=[point(1)];
for(j:=1;j<=n;j++){
L:=append(L,point(a+i*b));
c:=evalf(sqrt(a^2+b^2));
aa:=a;
bb:=b;
a:=aa-bb/c;
b:=bb+aa/c;
}
L;
}:;

then:

L:=seg(20); s:=segment(0,L[k])$(k=0..20)

Output:

then:

animation(s)

The output is an animation displaying the segments one at a time, beginning with:


Previous Up Next