summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/animations
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-07 18:26:53 +0000
committerKarl Berry <karl@freefriends.org>2013-04-07 18:26:53 +0000
commitb04c2e1a42573e9735547702356c7b9a769a6855 (patch)
treec0753443f39500a062d7698fe6b94359c813f871 /Master/texmf-dist/doc/asymptote/examples/animations
parentfb0bf13304a356f197bfc1add17f98c07e96f17b (diff)
texmf -> texmf-dist: doc
git-svn-id: svn://tug.org/texlive/trunk@29714 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/animations')
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/cube.asy46
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/earthmoon.asy78
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/embeddedmovie.asy24
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/embeddedu3d.asy6
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/externalmovie.asy17
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/glmovie.asy21
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/heatequation.asy76
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie.tex55
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie3.tex44
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/pdfmovie.asy20
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/slidemovies.asy47
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/sphere.asy42
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/torusanimation.asy43
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/wavepacket.asy86
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/animations/wheel.asy63
15 files changed, 668 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/cube.asy b/Master/texmf-dist/doc/asymptote/examples/animations/cube.asy
new file mode 100644
index 00000000000..001e54466d8
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/cube.asy
@@ -0,0 +1,46 @@
+import math;
+import bsp;
+import animation;
+
+size(100,100);
+
+animation a;
+
+void face(face[] faces, path3 p, int j, int k) {
+ picture pic=faces.push(p);
+ filldraw(pic,project(p),Pen(j));
+ int sign=(k % 2 == 0) ? 1 : -1;
+ transform t=scale(4)*transform(dir(p,0,sign),dir(p,0,-sign));
+ label(pic,t*(string) j,project(0.5*(min(p)+max(p))));
+}
+
+void snapshot(transform3 t)
+{
+ static transform3 s=shift(-0.5*(X+Y+Z));
+ save();
+
+ face[] faces;
+ int j=-1;
+ transform3 T=t*s;
+ for(int k=0; k < 2; ++k) {
+ face(faces,T*plane((1,0,0),(0,1,0),(0,0,k)),++j,k);
+ face(faces,T*plane((0,1,0),(0,0,1),(k,0,0)),++j,k);
+ face(faces,T*plane((0,0,1),(1,0,0),(0,k,0)),++j,k);
+ }
+ add(faces);
+
+ a.add();
+ restore();
+}
+
+int n=50;
+
+real step=360/n;
+for(int i=0; i < n; ++i)
+ snapshot(rotate(i*step,X));
+for(int i=0; i < n; ++i)
+ snapshot(rotate(i*step,Y));
+for(int i=0; i < n; ++i)
+ snapshot(rotate(i*step,Z));
+
+a.movie(loops=10,delay=50);
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/earthmoon.asy b/Master/texmf-dist/doc/asymptote/examples/animations/earthmoon.asy
new file mode 100644
index 00000000000..efca043b8bc
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/earthmoon.asy
@@ -0,0 +1,78 @@
+import graph3;
+import solids;
+import three;
+import animate;
+
+settings.render=2;
+settings.tex="pdflatex";
+settings.prc=false;
+settings.thick=false;
+settings.outformat="mpg";
+currentprojection=orthographic(5,4,2);
+currentlight=light(specular=black,(0.1,-0.1,1),viewport=true);
+
+size(15cm,0);
+
+animation A;
+
+real Rst=20, Rl=0.7, Rtl=5;
+real ast=20, est=0.3, bst=ast*sqrt(1-est^2), cst=ast*est;
+real atl=5, etl=0.8, btl=atl*sqrt(1-etl^2), ctl=atl*etl;
+
+real xST(real t) {return ast*cos(t)+cst;}
+real yST(real t) {return bst*sin(t);}
+real zST(real t) {return 0;}
+
+real xTL(real t) {return atl*cos(27t);}
+real yTL(real t) {return btl*sin(27t);}
+real zTL(real t) {return 0;}
+
+
+real xLl(real t) {return Rl*cos(27t);}
+real yLl(real t) {return Rl*sin(27t);}
+real zLl(real t) {return 0;}
+
+real xTt(real t) {return Rtl*cos(100t)/5;}
+real yTt(real t) {return Rtl*sin(100t)/5;}
+real zTt(real t) {return 0;}
+
+real xl(real t) {return xST(t)+xTL(t)+xLl(t);}
+real yl(real t) {return yST(t)+yTL(t)+yLl(t);}
+real zl(real t) {return 0;}
+
+real xt(real t) {return xST(t)+xTt(t);}
+real yt(real t) {return yST(t)+yTt(t);}
+real zt(real t) {return 0;}
+
+real xL(real t) {return xST(t)+xTL(t);}
+real yL(real t) {return yST(t)+yTL(t);}
+real zL(real t) {return 0;}
+
+path3 Pl=graph(xl,yl,zl,0,2pi,1000),Pt=graph(xt,yt,zt,0,2pi,3000),
+Pts=graph(xST,yST,zST,0,2pi,500);
+
+picture pic;
+
+draw(pic,Pl,lightgray);
+draw(pic,Pt,lightblue);
+draw(pic,Pts,blue+dashed);
+
+draw(pic,shift(cst,0,0)*scale3(Rtl/2)*unitsphere,yellow);
+
+surface terre=scale3(Rtl/5)*unitsphere;
+surface lune=scale3(Rl)*unitsphere;
+
+int n=50;
+
+real step=2pi/n;
+for(int i=0; i < n; ++i) {
+ real k=i*step;
+ add(pic);
+ draw(shift(xL(k),yL(k),0)*lune,lightgray);
+ draw(shift(xST(k),yST(k),0)*terre,lightblue+lightgreen);
+ A.add();
+ erase();
+}
+
+A.movie(BBox(1mm,Fill(Black)),delay=500,
+ options="-density 288x288 -geometry 50%x");
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/embeddedmovie.asy b/Master/texmf-dist/doc/asymptote/examples/animations/embeddedmovie.asy
new file mode 100644
index 00000000000..98dfd424db8
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/embeddedmovie.asy
@@ -0,0 +1,24 @@
+// An embedded movie;
+//
+// See http://www.tug.org/tex-archive/macros/latex/contrib/movie15/README
+// for documentation of the options.
+
+import embed; // Add embedded movie
+//import external; // Add external movie (use this form under Linux).
+
+// Generated needed mpeg file if it doesn't already exist.
+asy("mpg","wheel");
+
+// Produce a pdf file.
+settings.outformat="pdf";
+
+settings.twice=true;
+
+// An embedded movie:
+label(embed("wheel.mpg","poster,text=wheel.mpg,label=wheel.mpg",20cm,5.6cm),
+ (0,0),N);
+
+// An optional button:
+label(link("wheel.mpg","Play","play"),(0,0),S);
+
+
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/embeddedu3d.asy b/Master/texmf-dist/doc/asymptote/examples/animations/embeddedu3d.asy
new file mode 100644
index 00000000000..1116c216fe2
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/embeddedu3d.asy
@@ -0,0 +1,6 @@
+// An embedded U3D object;
+//
+import embed;
+
+label(embed("dice.u3d","poster,text=(dice.u3d),3Droo=27,label=dice",settings.paperwidth,settings.paperheight));
+
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/externalmovie.asy b/Master/texmf-dist/doc/asymptote/examples/animations/externalmovie.asy
new file mode 100644
index 00000000000..77c99528307
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/externalmovie.asy
@@ -0,0 +1,17 @@
+// Embed a movie to be run in an external window.
+
+import external;
+
+// External movies require the pdflatex engine.
+settings.tex="pdflatex";
+
+// Generated needed mpeg file if it doesn't already exist.
+asy("mpg","wheel");
+
+// Produce a pdf file.
+settings.outformat="pdf";
+
+// External movie: viewable even with the Linux version of acroread.
+label(embed("wheel.mpg"),(0,0),N);
+
+label(link("wheel.mpg","Play"),(0,0),S);
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/glmovie.asy b/Master/texmf-dist/doc/asymptote/examples/animations/glmovie.asy
new file mode 100644
index 00000000000..c3d86481b1b
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/glmovie.asy
@@ -0,0 +1,21 @@
+settings.autoplay=true;
+settings.loop=true;
+
+import graph3;
+import animate;
+currentprojection=orthographic(1,-2,0.5);
+
+animation A;
+int n=25;
+
+for(int i=0; i < n; ++i) {
+ picture pic;
+ size3(pic,6cm);
+ real k=i/n*pi;
+ real f(pair z) {return 4cos(abs(z)-k)*exp(-abs(z)/6);}
+ draw(pic,surface(f,(-4pi,-4pi),(4pi,4pi),Spline),paleblue);
+ draw(pic,shift(i*6Z/n)*unitsphere,yellow);
+ A.add(pic);
+}
+
+A.glmovie();
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/heatequation.asy b/Master/texmf-dist/doc/asymptote/examples/animations/heatequation.asy
new file mode 100644
index 00000000000..3c5708e583f
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/heatequation.asy
@@ -0,0 +1,76 @@
+import graph3;
+import palette;
+import animate;
+
+settings.tex="pdflatex";
+settings.render=0;
+settings.prc=false;
+unitsize(1cm);
+
+animation a;
+
+currentprojection=perspective(-20,-18,18);
+currentlight=light(1,1,10);
+
+int n=26;
+real L=2.5;
+real dx=2*L/n;
+real CFL=0.125;
+real dt=CFL*dx^2;
+
+real[][] Z=new real[n][n];
+real[][] W=new real[n][n];
+
+guide initcond1=shift((-1,-1))*scale(0.5)*unitcircle;
+guide initcond2=shift((0.5,0))*yscale(1.2)*unitcircle;
+
+real f(pair p) {return (inside(initcond1,p)||inside(initcond2,p)) ? 2 : 0;}
+
+//Initialize
+for(int i=0; i < n; ++i)
+ for (int j=0; j < n; ++j)
+ Z[i][j]=f((-L,-L)+(2*L/n)*(i,j));
+
+real f(pair t) {
+ int i=round((n/2)*(t.x/L+1));
+ int j=round((n/2)*(t.y/L+1));
+ if(i > n-1) i=n-1;
+ if(j > n-1) j=n-1;
+ return Z[i][j];
+}
+
+surface sf;
+
+void advanceZ(int iter=20) {
+ for(int k=0; k < iter; ++k) {
+ for(int i=0; i < n; ++i)
+ for(int j=0; j < n; ++j) W[i][j]=0;
+ for(int i=1; i < n-1; ++i)
+ for(int j=1; j< n-1; ++j)
+ W[i][j]=Z[i][j]+(dt/dx^2)*(Z[i+1][j]+Z[i-1][j]+Z[i][j-1]+Z[i][j+1]
+ -4*Z[i][j]);
+ for(int i=0; i < n; ++i)
+ for(int j=0; j < n; ++j)
+ Z[i][j]=W[i][j];
+ };
+}
+
+pen[] Pal=Rainbow(96);
+
+int endframe=40;
+
+for(int fr=0; fr < endframe; ++fr) {
+ if(fr == 0) {// smoothing of initial state; no Spline, but full grid
+ advanceZ(3);
+ sf=surface(f,(-L,-L),(L,L),nx=n);
+ } else // use Spline and fewer grid points to save memory
+ sf=surface(f,(-L,-L),(L,L),nx=round(n/2),Spline);
+ sf.colors(palette(sf.map(zpart),Pal[0:round(48*max(sf).z)]));
+ draw(sf);
+ a.add();
+ erase();
+ advanceZ(30);
+};
+
+label(a.pdf(delay=400,"controls,loop"));
+shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(fillpen=paleblue)),"pdf");
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie.tex b/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie.tex
new file mode 100644
index 00000000000..5f1eff9d4bb
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie.tex
@@ -0,0 +1,55 @@
+\documentclass{article}
+\usepackage[inline]{asymptote}
+%\usepackage{asymptote}
+\usepackage{animate}
+\begin{document}
+
+Here is an inline PDF movie, generated with the commands
+\begin{verbatim}
+pdflatex inlinemovie
+asy inlinemovie-*.asy
+pdflatex inlinemovie
+\end{verbatim}
+or equivalently,
+\begin{verbatim}
+latexmk -pdf inlinemovie
+\end{verbatim}
+
+\begin{center}
+\begin{asy}
+import animate;
+animation A=animation("movie1");
+real h=2pi/10;
+
+picture pic;
+unitsize(pic,2cm);
+for(int i=0; i < 10; ++i) {
+ draw(pic,expi(i*h)--expi((i+1)*h));
+ A.add(pic);
+}
+label(A.pdf("controls",delay=50,keep=!settings.inlinetex));
+\end{asy}
+%Uncomment the following line when not using the [inline] package option:
+%\ASYanimategraphics[controls]{50}{movie1}{}{}
+\end{center}
+
+And here is another one, clickable but without the control panel:
+\begin{center}
+\begin{asy}
+import animate;
+animation A=animation("movie2");
+real h=2pi/10;
+
+picture pic;
+unitsize(pic,2cm);
+for(int i=0; i < 10; ++i) {
+ draw(pic,expi(-i*h)--expi(-(i+1)*h),red);
+ A.add(pic);
+}
+label(A.pdf(keep=!settings.inlinetex));
+\end{asy}
+%Uncomment the following line when not using the [inline] package option:
+%\ASYanimategraphics[controls]{10}{movie2}{}{}
+\end{center}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie3.tex b/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie3.tex
new file mode 100644
index 00000000000..5131c652a11
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/inlinemovie3.tex
@@ -0,0 +1,44 @@
+\documentclass{article}
+\usepackage[inline]{asymptote}
+%\usepackage{asymptote}
+\usepackage{animate}
+\begin{document}
+
+Here is an inline 3D PDF movie, generated with the commands
+\begin{verbatim}
+pdflatex inlinemovie3
+asy inlinemovie3-*.asy
+pdflatex inlinemovie3
+\end{verbatim}
+or equivalently,
+\begin{verbatim}
+latexmk -pdf inlinemovie3
+\end{verbatim}
+
+\begin{center}
+\begin{asy}
+settings.render=4;
+settings.prc=false;
+
+import graph3;
+import animate;
+currentprojection=orthographic(1,-2,0.5);
+
+animation A=animation("movie3");
+int n=20;
+for(int i=0; i < n; ++i) {
+ picture pic;
+ size3(pic,12cm,12cm,8cm);
+ real k=i/n*pi;
+ real f(pair z) {return 4cos(abs(z)-k)*exp(-abs(z)/6);}
+ draw(pic,surface(f,(-4pi,-4pi),(4pi,4pi),Spline),paleblue);
+ draw(pic,shift(i*6Z/n)*unitsphere,yellow);
+ A.add(pic);
+}
+label(A.pdf("autoplay,loop",delay=20,keep=!settings.inlinetex));
+\end{asy}
+%Uncomment the following line when not using the [inline] package option:
+%\ASYanimategraphics[autoplay,loop]{50}{movie3}{}{}
+\end{center}
+\end{document}
+
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/pdfmovie.asy b/Master/texmf-dist/doc/asymptote/examples/animations/pdfmovie.asy
new file mode 100644
index 00000000000..0f9cbc96445
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/pdfmovie.asy
@@ -0,0 +1,20 @@
+import animate;
+import patterns;
+
+settings.tex="pdflatex";
+
+animation a;
+
+add("brick",brick(black));
+
+int n=20;
+for(int i=0; i < 3.5n; ++i) {
+ picture pic;
+ size(pic,100);
+ path g=circle((0,sin(pi/n*i)),1);
+ fill(pic,g,mediumred);
+ fill(pic,g,pattern("brick"));
+ a.add(pic);
+}
+
+label(a.pdf("controls",multipage=false));
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/slidemovies.asy b/Master/texmf-dist/doc/asymptote/examples/animations/slidemovies.asy
new file mode 100644
index 00000000000..205f94fbc85
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/slidemovies.asy
@@ -0,0 +1,47 @@
+// Slide demo.
+// Command-line options to enable stepping and/or reverse video:
+// asy [-u stepping=true] [-u reverse=true] slidedemo
+
+orientation=Landscape;
+
+settings.tex="pdflatex";
+
+import slide;
+
+// Optional movie modules:
+import animate; // For portable embedded PDF movies
+access external; // For portable external movies
+access embed; // For non-portable embedded movies
+
+usersetting();
+
+titlepage("Slides with {\tt Asymptote}: Animations","John C. Bowman",
+ "University of Alberta","\today","http://asymptote.sf.net");
+
+title("Embedded PDF movies (portable)");
+animation a=animation("A");
+animation b=animation("B");
+int n=20;
+for(int i=0; i < 2n; ++i) {
+ picture pic;
+ size(pic,100);
+ draw(pic,shift(0,sin(pi/n*i))*unitsquare);
+ a.add(pic);
+ if(i < 1.5n) b.add(rotate(45)*pic);
+}
+display(a.pdf("autoplay,loop,controls",multipage=false));
+display(b.pdf("controls",multipage=false));
+
+// Generated needed files if they don't already exist.
+asy("mpg","wheel");
+
+title("External Movie (portable)");
+display(external.embed("wheel.mpg",
+ "poster,text=wheel.mpg,label=wheel.mpg",20cm,5.6cm));
+display(external.link("wheel.mpg","Play","play"));
+
+title("Embedded Movie (not portable)");
+display(embed.embed("wheel.mpg",
+ "poster,text=wheel.mpg,label=wheel.mpg",
+ 20cm,5.6cm));
+display(embed.link("wheel.mpg","Play","play"));
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/sphere.asy b/Master/texmf-dist/doc/asymptote/examples/animations/sphere.asy
new file mode 100644
index 00000000000..125cecc5566
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/sphere.asy
@@ -0,0 +1,42 @@
+import solids;
+import animation;
+
+currentprojection=orthographic((0,5,2));
+currentlight=(0,5,5);
+
+settings.thick=false;
+settings.render=0;
+
+int nbpts=200;
+real step=2*pi/nbpts;
+int angle=10;
+
+unitsize(1cm);
+
+triple[] P=new triple[nbpts];
+for(int i=0; i < nbpts; ++i) {
+ real t=-pi+i*step;
+ P[i]=(3sin(t)*cos(2t),3sin(t)*sin(2t),3cos(t));
+}
+
+transform3 t=rotate(angle,(0,0,0),(1,0.25,0.25));
+revolution r=sphere(O,3);
+draw(surface(r),lightgrey);
+draw(r,backpen=linetype("8 8",8));
+
+animation A;
+
+for(int phi=0; phi < 360; phi += angle) {
+ bool[] front=new bool[nbpts];
+ save();
+ for(int i=0; i < nbpts; ++i) {
+ P[i]=t*P[i];
+ front[i]=dot(P[i],currentprojection.camera) > 0;
+ }
+ draw(segment(P,front,operator ..),1mm+blue+extendcap);
+ draw(segment(P,!front,operator ..),grey);
+ A.add();
+ restore();
+}
+
+A.movie(0,200);
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/torusanimation.asy b/Master/texmf-dist/doc/asymptote/examples/animations/torusanimation.asy
new file mode 100644
index 00000000000..74a5df43278
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/torusanimation.asy
@@ -0,0 +1,43 @@
+import graph3;
+import animation;
+import solids;
+
+currentprojection=perspective(50,40,20);
+
+currentlight=(0,5,5);
+
+real R=3;
+real a=1;
+int n=8;
+
+path3[] p=new path3[n];
+animation A;
+
+for(int i=0; i < n; ++i) {
+ triple g(real s) {
+ real twopi=2*pi;
+ real u=twopi*s;
+ real v=twopi/(1+i+s);
+ real cosu=cos(u);
+ return((R-a*cosu)*cos(v),(R-a*cosu)*sin(v),-a*sin(u));
+ }
+ p[i]=graph(g,0,1,operator ..);
+}
+
+triple f(pair t) {
+ real costy=cos(t.y);
+ return((R+a*costy)*cos(t.x),(R+a*costy)*sin(t.x),a*sin(t.y));
+}
+
+surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline);
+
+for(int i=0; i < n; ++i){
+ picture fig;
+ size(fig,20cm);
+ draw(fig,s,yellow);
+ for(int j=0; j <= i; ++j)
+ draw(fig,p[j],blue+linewidth(4));
+ A.add(fig);
+}
+
+A.movie(BBox(10,Fill(rgb(0.98,0.98,0.9))),delay=100);
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/wavepacket.asy b/Master/texmf-dist/doc/asymptote/examples/animations/wavepacket.asy
new file mode 100644
index 00000000000..006fbce1543
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/wavepacket.asy
@@ -0,0 +1,86 @@
+// Author : Philippe Ivaldi
+// http://www.piprime.fr/
+// 2006/11/10
+
+import animation;
+import graph;
+
+unitsize(x=2cm,y=1.5cm);
+
+typedef real realfcn(real);
+
+real lambda=4;
+real T=2;
+real [] k=new real[3];
+real [] w=new real[3];
+k[0]=2pi/lambda;
+w[0]=2pi/T;
+real dk=-.5;
+k[1]=k[0]-dk;
+k[2]=k[0]+dk;
+real dw=1;
+w[1]=w[0]-dw;
+w[2]=w[0]+dw;
+
+real vp=w[1]/k[1];
+real vg=dw/dk;
+
+realfcn F(real x) {
+ return new real(real t) {
+ return cos(k[1]*x-w[1]*t)+cos(k[2]*x-w[2]*t);
+ };
+};
+
+realfcn G(real x) {
+ return new real(real t) {
+ return 2*cos(0.5*(k[2]-k[1])*x+0.5*(w[1]-w[2])*t);
+ };
+};
+
+realfcn operator -(realfcn f) {return new real(real t) {return -f(t);};};
+
+animation A;
+
+real tmax=abs(2pi/dk);
+real xmax=abs(2pi/dw);
+
+pen envelope=0.8*blue;
+pen fillpen=lightgrey;
+
+int n=50;
+real step=tmax/(n-1);
+for(int i=0; i < n; ++i) {
+ save();
+ real t=i*step;
+ real a=xmax*t/tmax-xmax/pi;
+ real b=xmax*t/tmax;
+ path f=graph(F(t),a,b);
+ path g=graph(G(t),a,b);
+ path h=graph(-G(t),a,b);
+ fill(buildcycle(reverse(f),g),fillpen);
+ draw(f);
+ draw(g,envelope);
+ draw(h,envelope);
+ A.add();
+ restore();
+}
+
+for(int i=0; i < n; ++i) {
+ save();
+ real t=i*step;
+ real a=-xmax/pi;
+ real b=xmax;
+ path f=graph(F(t),a,b);
+ path g=graph(G(t),a,b);
+ path h=graph(-G(t),a,b);
+ path B=box((-xmax/pi,-2),(xmax,2));
+ fill(buildcycle(reverse(f),g,B),fillpen);
+ fill(buildcycle(f,g,reverse(B)),fillpen);
+ draw(f);
+ draw(g,envelope);
+ draw(h,envelope);
+ A.add();
+ restore();
+}
+
+A.movie(0,10);
diff --git a/Master/texmf-dist/doc/asymptote/examples/animations/wheel.asy b/Master/texmf-dist/doc/asymptote/examples/animations/wheel.asy
new file mode 100644
index 00000000000..6620d590850
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/animations/wheel.asy
@@ -0,0 +1,63 @@
+import graph;
+
+// Uncomment the following 2 lines to support pdf animations:
+// usepackage("animate");
+// settings.tex="pdflatex";
+
+import animation;
+
+size(0,200);
+
+defaultpen(3);
+dotfactor=4;
+
+pair wheelpoint(real t)
+{
+ return (t+cos(t),-sin(t));
+}
+
+guide wheel(guide g=nullpath, real a, real b, int n)
+{
+ real width=(b-a)/n;
+ for(int i=0; i <= n; ++i) {
+ real t=a+width*i;
+ g=g--wheelpoint(t);
+ }
+ return g;
+}
+
+real t1=0;
+real t2=t1+2*pi;
+
+animation a;
+
+draw(circle((0,0),1));
+draw(wheel(t1,t2,100),linetype("0 2"));
+yequals(Label("$y=-1$",1.0),-1,extend=true,linetype("4 4"));
+xaxis(Label("$x$",align=3SW),0);
+yaxis("$y$",0,1.2);
+pair z1=wheelpoint(t1);
+pair z2=wheelpoint(t2);
+dot(z1);
+dot(z2);
+
+int n=10;
+real dt=(t2-t1)/n;
+for(int i=0; i <= n; ++i) {
+ save();
+
+ real t=t1+dt*i;
+ draw(circle((t,0),1),red);
+ dot(wheelpoint(t));
+
+ a.add(); // Add currentpicture to animation.
+ restore();
+}
+
+erase();
+
+// Merge the images into a gif animation.
+a.movie(BBox(0.25cm),loops=10,delay=250);
+
+// Merge the images into a pdf animation.
+// label(a.pdf(BBox(0.25cm),delay=250,"controls",multipage=false));