Al fin después de tanto luchar ya hallamos la respuesta de este apuro que agunos usuarios de este espacio han tenido. Si tienes algún dato que compartir no dudes en dejar tu conocimiento.
Solución:
Solo porque amo un buen desafío.
Compilado usando convert -delay 10 -loop 0 -density 300 -scale 400 -alpha remove
.
Funciones / mejoras que faltan:
- línea roja “curva”, no estoy seguro de cómo hacerlo fácilmente.
- Algunas transiciones deberían pausarse más. Intentaré arreglarlo más tarde.
- Es posible que se reduzcan varios comandos repetidos.
Producción
El archivo es 973 KB
Código
254 líneas! 😀
documentclass[tikz, margin=10pt]standalone
usetikzlibrarycalc, arrows, backgrounds
newcommandrad57.296
pgfmathsetmacroradqrad*2
pgfmathsetmacroradcrad*3
tikzset
dots/.style=fill=#1, circle, inner sep=2pt,
angle/.style=draw=green!70!black, fill=green!30,
mainline/.style=green!70!black, very thick,
arc/.style=red, very thick,
rads/.style=very thin,
begindocument
foreach x [count=xx, evaluate=x as xy using (185-xx*5)] in 0,.5,...,4,4,4,4,4
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
node[dots=red] (a) at (0,0) ;
node[dots=red] (b) at (x,0) ;
draw[arc] (a) -- (b);
endtikzpicture
foreach ang in 0,15,...,360
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
node[dots=red] (a) at (0,0) ;
node[dots=red] (b) at (ang:4) ;
draw[blue, thick] (4,0) arc (0:ang:4);
draw[arc] (a) -- (b);
endtikzpicture
foreach x [evaluate=x as opac using (x/10)] in 0,0,0,1,...,9,10,10,10,10,10,10,10,9,...,0,0,0
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
node[dots=red] (a) at (0,0) ;
node[dots=red] (b) at (0:4) ;
draw[arc] (a) -- (b) node[midway, above, yshift=5mm, font=Huge, text opacity=opac] r;
endtikzpicture
foreach ang in 180,165,...,90
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
node[dots=black] (c) at (0,0) ;
node[dots=red, xshift=4cm] (a) at (ang:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) --++ (ang:4);
endtikzpicture
%foreach ang [count=x, evaluate=x as xx using int(80/x)] in 15,...,rad
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
node[dots=black] (c) at (0,0) ;
node[dots=red] (a) at (rad:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) arc (0:rad:4);
endtikzpicture
%
%
foreach x [evaluate=x as grad using (x/10)] in 0,...,10
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
node[dots=red] (a) at (rad:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) arc (0:rad:4);
beginscope[opacity=grad]
draw[mainline] (b) -- (0,0) -- (a);
filldraw[angle] (0,0) -- (1,0) arc (0:rad:1) -- cycle;
endscope
node[dots=black] (c) at (0,0) ;
endtikzpicture
foreach x [evaluate=x as grad using (x/10)] in 0,...,10
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
node[dots=red] (a) at (rad:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) arc (0:rad:4);
draw[mainline] (b) -- (0,0) -- (a);
filldraw[angle] (0,0) -- (1,0) arc (0:rad:1) -- cycle;
node[dots=black] (c) at (0,0) ;
beginscope[opacity=grad]
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $1$ rad;
endscope
endtikzpicture
foreach ang [count=cc] in 0,10,...,rad, rad, rad, rad, rad
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[mainline] (4,0) arc (0:ang:4);
node[dots=green!50!black] (d) at (4,0) ;
beginscope[rotate around=ang:(0,0)]
node[dots=red] (a) at (rad:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) arc (0:rad:4);
draw[mainline] (0,0) -- (a);
draw[rads] (0,0) -- (b);
endscope
filldraw[angle] (0,0) -- (1,0) arc (0:ang+rad:1) -- cycle;
node[dots=black] (c) at (0,0) ;
ifnumcc<8
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $1$ rad;
else
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $2$ rad;
fi
endtikzpicture
foreach ang [count=cc, evaluate=ang as bng using int(ang+rad)] in 0,10,...,rad, rad, rad, rad, rad
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[green!70!black, very thick] (4,0) arc (0:bng:4);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (e) at (rad:4) ;
draw[mainline] (0,0) -- (d);
draw[rads] (0,0) -- (e);
beginscope[rotate around=bng:(0,0)]
node[dots=red] (a) at (rad:4) ;
node[dots=red] (b) at (4,0) ;
draw[arc] (4,0) arc (0:rad:4);
draw[mainline] (0,0) -- (a);
draw[rads] (0,0) -- (b);
endscope
filldraw[angle] (0,0) -- (1,0) arc (0:bng+rad:1) -- cycle;
node[dots=black] (c) at (0,0) ;
ifnumcc<8
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $2$ rad;
else
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $3$ rad;
fi
endtikzpicture
foreach dng [count=cc, evaluate=cc as cng using (radq+rad/9*cc)] in radc,...,180
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[mainline] (4,0) arc (0:cng:4);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (e) at (rad:4) ;
node[dots=green!50!black] (f) at (rad*2:4) ;
draw[mainline] (0,0) -- (d);
draw[rads] (0,0) -- (e);
draw[rads] (0,0) -- (f);
node[dots=red] (a) at (cng:4) ;
node[dots=red] (b) at (dng:4) ;
draw[arc] (cng:4) arc (cng:dng:4);
draw[mainline] (0,0) -- (b);
draw[rads] (0,0) -- (a);
filldraw[angle] (0,0) -- (1,0) arc (0:dng:1) -- cycle;
node[dots=black] (c) at (0,0) ;
ifnumcc<9
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $3$ rad;
else
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $pi$ rad;
fi
endtikzpicture
foreach x [evaluate=x as grad using (x/10)] in 10,...,0,0,0,0,0,0,0,0
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[mainline] (4,0) arc (0:180:4);
draw[mainline] (0,0) -- (d);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (b) at (180:4) ;
beginscope[opacity=grad]
node[dots=green!50!black] (e) at (rad:4) ;
node[dots=green!50!black] (f) at (rad*2:4) ;
draw[rads] (0,0) -- (e);
draw[rads] (0,0) -- (f);
draw[rads] (0,0) -- (a);
node[dots=red] (a) at (radc:4) ;
node[dots=red] (b) at (180:4) ;
draw[arc] (radc:4) arc (radc:180:4);
endscope
draw[mainline] (0,0) --++ (180:4);
filldraw[angle] (0,0) -- (1,0) arc (0:180:1) -- cycle;
node[dots=black] (c) at (0,0) ;
node[anchor=north, yshift=-5mm, font=Huge, text=green!50!black] at (0,0) $pi$ rad;
endtikzpicture
foreach x in 0,5,...,20
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[mainline] (4,0) arc (0:180:4);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (b) at (180:4) ;
draw[mainline] (d) -- (b);
filldraw[angle] (0,0) -- (1,0) arc (0:180:1) -- cycle;
node[dots=black] (c) at (0,0) ;
node[anchor=north, yshift=x mm, font=Huge, text=green!50!black] at (0,0) $pi$ rad;
endtikzpicture
foreach ang [count=x starting from 0, evaluate=x as grad using (x/10)] in 180,198,...,360
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
draw[blue, thick] (0,0) circle (4);
draw[mainline] (4,0) arc (0:ang:4);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (b) at (180:4) ;
node[dots=green!50!black] (g) at (ang:4) ;
draw[mainline] (0,0) -- (d);
draw[mainline] (0,0) -- (g);
filldraw[angle] (0,0) -- (1,0) arc (0:ang:1) -- cycle;
node[dots=black] (c) at (0,0) ;
node[anchor=north, yshift=2cm, font=Huge, text=green!50!black] at (0,0) $pi$ rad;
node[anchor=north, yshift=2cm, font=Huge, text=green!50!black, text opacity=grad] at (0,0) $2$phantom$2pi$ rad;
endtikzpicture
foreach x [evaluate=x as grad using (x/10)] in 10,...,0,0
begintikzpicture
draw[gray] (-5,0) -- (5,0);
draw[gray] (0,-5) -- (0,5);
node[dots=red] (a) at (0,0) ;
beginscope[opacity=grad]
draw[mainline] (4,0) arc (0:360:4);
node[dots=green!50!black] (d) at (4,0) ;
node[dots=green!50!black] (b) at (180:4) ;
node[dots=green!50!black] (g) at (0:4) ;
draw[mainline] (0,0) -- (d);
draw[mainline] (0,0) -- (g);
filldraw[angle] (0,0) -- (1,0) arc (0:360:1) -- cycle;
node[dots=black] (c) at (0,0) ;
node[anchor=north, yshift=2cm, font=Huge, text=green!50!black] at (0,0) $pi$ rad;
node[anchor=north, yshift=2cm, font=Huge, text=green!50!black, text opacity=grad] at (0,0) $2$phantom$2pi$ rad;
endscope
endtikzpicture
enddocument
Es mucho trabajo conseguir todos los pasos intermedios. Es mucho más fácil usar una clase de presentación sin la animación. Aquí hay un entrante:
documentclassbeamer
usepackagepstricks-add,multido
begindocument
beginframe[plain]
centering
defRadius3
beginpspicture(-4,-4)(4,4)
psdot[dotsize=1mm,linecolor=red](0,0)pause
psline[arrows=*-*,linewidth=1.5pt,linecolor=red](3,0)pause
multidoiA=0+3013%
psarc[arrows=*-*,linewidth=1.5pt,linecolor=blue](0,0)30iApause
pswedge[linecolor=red,arrows=*-*,linewidth=1.5pt](3,0)390180pause
psarc[arrows=*-*,linewidth=1.5pt,linecolor=green](0,0)30!1 RadtoDeg
endpspicture
endframe
enddocument
Si no quiere los puntos, use
multidoiA=0+3013%
psarc[arrows=-*,linewidth=1.5pt,linecolor=white](0,0)30!iAspace 30 sub
psarc[arrows=*-*,linewidth=1.5pt,linecolor=blue](0,0)30iApause
El PDF fue convertido en gif por
convert -delay 50 -loop 0 -density 300 -scale 300 -alpha remove zz.pdf zz.gif
Otros ejemplos se pueden encontrar aquí: http://tug.org/PSTricks/main.cgi?file=Animation/gif/gif
El código original en la pregunta editada se compiló bien, pero produce marcos para dibujos animados de elipse en lugar de dibujos animados de círculos.
Asumiendo que 'no funcionarefers to the fact that the picture draws an ellipse rather than a circle, this is relatively easily fixed, even with no knowledge of
pstricks. (I say this only because I have no such knowledge and therefore disclaim all
responsabilidades relacionadas con pstricks para lo siguiente, es decir, si el código de la pregunta contiene boo-boos obvios, no serán obvios para mí).
Empecé con
beginpspicture(-2.5,-2.0)(2.5,2.0)
lo que sugirió un marco rectangular, adecuado para una elipse, en lugar de uno cuadrado, adecuado para un cuadrado. Entonces cambié las proporciones:
beginpspicture(-2.5,-2.5)(2.5,2.5)
Esto se compiló para darme una elipse en un marco cuadrado. Entonces supuse que las siguientes líneas se refieren a los dos ejes:
/major 2.25 def
/minor 1.75 def
y pensé que intentaría enmendar los siguientes:
/major 2.25 def
/minor 2.25 def
y eso funcionó: ahora tengo 37 cuadros que muestran el dibujo de un círculo en lugar de una elipse.
documentclass[pstricks,border=0pt]standalone
usepackagepstricks-add
pstVerb
/major 2.25 def
/minor 2.25 def
% b a t p2c ---> x y
% where b (semi-minor), a (semi-major), t (theta)
/p2c dup 3 1 roll cos mul 3 1 roll sin mul bind def
pssetarrows=-*
begindocument
multidoi=0+1037
beginpspicture(-2.5,-2.5)(2.5,2.5)
ifnumi=0
% don't draw arc!
else
psellipticarc[linecolor=cyan,dimen=middle](!major minor)0(!minor major ispace p2c)%dimen=middle must be specified!
fi
psline[linecolor=red](!minor major ispace p2c)
uput5mm[!ispace 10 add](0,0)tiny$i^circ$
endpspicture
enddocument
EDITAR
Estaba tratando de descubrir cómo convertir mi PDF en un GIF animado cuando Herbert publicó la solución en su respuesta mucho más experta. Es decir, usando
convert -delay 50 -loop 0 -density 300 -scale 300 -alpha remove .pdf .gif
Produje esto (que espero que funcione, no estoy seguro de cómo saberlo)
Valoraciones y comentarios
Si te ha sido de provecho nuestro post, nos gustaría que lo compartas con el resto programadores y nos ayudes a difundir este contenido.