how to do animation in Wolfram language
- interactive animation.
- show sine, and in
Manipulate
, and ListAnimate
- show moving a circle, and animate it
- show Export, to mp4, and to gif
xah talk show 2025-05-23 1ff1b
Plot[Sin[x], {x,0,2 Pi}]
xgraphicsList=
Table[
Plot[Sin[x t], {x,0,2 Pi}, PlotRange -> {{0,7},{-1,1}}],
{t, 0.1, 1, 0.1}
];
ListAnimate[ xgraphicsList ]
Export[ "sine_of_sine.mp4" , xgraphicsList]
Manipulate[
Plot[Sin[x t],{x,0,2 Pi},PlotRange->{{0,7},{-1,1}}],
{t, 0.1, 1, 0.1}
]
xx=
Manipulate[
Plot[Sin[Sin[x] t 2], {x, 0, 2 Pi},
PlotRange -> {{0, 7}, {-1, 1}}], {t, 1, 2, 0.1}]
Export[ "sine_of_sine.mp4" , xx]
Export[ "sine_of_sine.gif" , xx]
ListAnimate[
Table[
Plot[
x^3 - t x^2
, {x,-5,5}, PlotRange -> {{0,7},{-1,1}}],
{t, 0.1, 1, 0.1}
]
]
sine of sine
create your own graphics for animation
xgraphicsList =
Table[Graphics[Circle[{t, 0}, 1], Axes -> True,
PlotRange -> {{0, 10}, {-1, 1}}], {t, 0, 10, 1}]
ListAnimate[ xgraphicsList ]
Export[ "moving circle.mp4" , xgraphicsList]
Example. 3d animation
- Fantastic geometric inversion of cubes.
- Animate tiny cubes to big.
- Wolfram language code.
Manipulate[
geoInv = ((With[{x662 = # . #},
If[x662 < 0.00000001, #, #/x662]]) &);
cubes = Table[
Cube[{x, y, z}, tt], {x, -3, 3}, {y, 0, 3}, {z, -3, 3}] /.
Cube[{(0) ..}, _] -> Nothing;
Graphics3D[{Cyan,
cubes /. x_Cube -> CanonicalizePolyhedron[x] /.
Polyhedron[pts_, g_] :> Polyhedron[geoInv /@ pts, g]},
Boxed -> False, PlotRange -> 0.4]
,
{tt, 0.1 , 0.8}
]
xah talk show 2025-05-23 1fc36