[pstricks] morphing from a square to a circle over 10 steps

mathias legrand legrand.mathias at gmail.com
Wed Nov 11 03:20:46 CET 2009


> Just one suggestion:
>
> \documentclass{article}
> \usepackage{pstricks-add}
> \usepackage{multido}
>
> \begin{document}
>
> \begin{pspicture}{->}(-5,-5)(5,5)
> \psaxes[ticksize=-3pt 0]{->}(0,0)(-5,-5)(5,5)
> \multido{\n=1+0.1}{9}{
> \parametricplot[linecolor=red,plotpoints=200]{0}{180}{t cos 5 mul t cos
> abs \n\space exp neg 1 add \n\space 1 exch div exp 5 mul}%
> \parametricplot[linecolor=red,plotpoints=200]{0}{180}{t cos 5 mul t cos
> abs \n\space exp neg 1 add \n\space 1 exch div exp 5 mul neg}}%
> \end{pspicture}
>
> \end{document
Thank Poul, i'll try your suggestion but I found a solution by playing 
with the linearc parameter of the \psframe command:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[a4paper]{geometry}
\usepackage[dvips]{color}
\usepackage{lmodern}
\usepackage{pst-all}
\usepackage{fp}
\usepackage{calc} % pour la deuxième version
\newcounter{couleurA}
\newcounter{angleA}
\usepackage[frenchb]{babel}


\definecolor{ocre}{RGB}{243,102,25}


\begin{document}

\begin{pspicture}(0,0)(15,20)
  \psset{fillstyle=solid, linewidth=2pt}
  \psgrid
 \multido{\i=0+1}{5}{%
   \FPeval{\posXA}{1.5*\i}%
   \multido{\I=0+1}{5}{%
      \FPeval{\posYA}{1.5*\I}%
      \FPeval{\couleurA}{3*\I+2*\i}%
      \FPeval{\couleurB}{100-\couleurA}%
      \FPeval{\coeff}{\i/3+\I/3}%
      \setcounter{angleA}{4*\I+4*\i}%
      \setcounter{couleurA}{3*\I+2*\i}%
      
\rput[c]{\theangleA}(\posXA,\posYA){\psframe[fillstyle=solid,fillcolor=black!\thecouleurA,linecolor=ocre!\couleurB](0,0)(1,1)}
}
}
\end{pspicture}

\end{document}




More information about the PSTricks mailing list