동적 회전 진자

동적 회전 진자

여기에 이미지 설명을 입력하세요봉쥬르. 원뿔 진자에 대한 이 코드가 있습니다. 타원을 통해 이동(균일 회전)하기를 원합니다. 코드를 어떻게 수정할 수 있나요?

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\begin{document}
\begin{tikzpicture}[scale=1, decoration={coil,aspect=0.6,segment length=1.5mm,amplitude=1.5mm}] 
\tikzset{ressort/.style={thick,gray,smooth}} 
\draw[ressort,decorate] (0,0)--++(-2,+5); 
\node at (-0.8,3) {$\ell$}; 
\draw [rounded corners=10pt,color=white,ball color=red,smooth] (0,0) circle (0.2); 
\draw [xshift=0.3cm,rotate around={180:(-0.4,2.2)},line width=1pt,-stealth] (1.8,1.7) arc (-30:210:0.3cm and 0.2cm) node[below left=0.4cm] {$\omega$};
\draw[dotted](-2,0) ellipse (2cm and 0.6cm);
\draw  (-2,-0.4)--++(0,5.4); 
\fill [pattern=north east lines,rotate=0] (-2.5,5) rectangle (-1.5,5.3); 
\draw[thick] (-2.5,5) --++ (1,0); 
\end{tikzpicture}
\end{document}

답변1

이 같은?

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,bending,calc,decorations.pathmorphing,patterns}
\begin{document}
\foreach \X in {0,10,...,350}
{\begin{tikzpicture}[scale=1,ressort/.style={thick,gray}]
  \path[use as bounding box] (-2.5,-0.9) rectangle (2.5,5.5);
  \draw[dotted](0,0) circle[x radius=2cm, y radius=0.6cm];
  \ifnum\X<180
   \draw let \p1=($([yshift=1.2mm]\X:2cm and 0.6cm)-(0,5)$),\n1={veclen(\x1,\y1)} in 
   [ressort,decorate, decoration={coil,aspect=0.6,segment length=\n1/36,amplitude=1.5mm}] 
   (0,5)-- ([yshift=1.2mm]\X:2cm and 0.6cm) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
   \draw [ball color=red] 
   (\X:2cm and 0.6cm) circle[radius=0.2cm]; 
   \draw[-{stealth},thick] 
   ({0.3*cos(150)},1.7) arc (150:390:0.3cm and 0.2cm) node[below left=0.4cm] {$\omega$};
   \draw  (0,-0.4)--++(0,5.4); 
  \else
   \draw[-{stealth},thick] 
   ({0.3*cos(150)},1.7) arc (150:390:0.3cm and 0.2cm) node[below left=0.4cm] {$\omega$};
   \draw  (0,-0.4)--++(0,5.4); 
   \draw let \p1=($([yshift=1.2mm]\X:2cm and 0.6cm)-(0,5)$),\n1={veclen(\x1,\y1)} in 
   [ressort,decorate, decoration={coil,aspect=0.6,segment length=\n1/36,amplitude=1.5mm}] 
   (0,5)-- ([yshift=1.2mm]\X:2cm and 0.6cm) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
   \draw [ball color=red] 
   (\X:2cm and 0.6cm) circle[radius=0.2cm]; 
  \fi
  \fill [pattern=north east lines,rotate=0] (-0.5,5) rectangle (0.5,5.3); 
  \draw[thick] (-0.5,5) --++ (1,0); 
\end{tikzpicture}}
\end{document}

여기에 이미지 설명을 입력하세요

PDF로 애니메이션을 제작하는 버전입니다.

\documentclass{article} 
\usepackage{animate}
\usepackage{tikz}
\usetikzlibrary{bending,calc,decorations.pathmorphing,patterns}
\begin{document}
\begin{center}
\begin{animateinline}[controls,buttonsize=0.5em,autoplay,loop]{2}
\multiframe{36}{i=0+1}{
 \begin{tikzpicture}[scale=1,ressort/.style={thick,gray}]
  \pgfmathtruncatemacro{\X}{\i*10}
  \path[use as bounding box] (-2.5,-0.9) rectangle (2.5,5.5);
  \draw[dotted](0,0) circle[x radius=2cm, y radius=0.6cm];
  \ifnum\X<180
   \draw let \p1=($([yshift=1.2mm]\X:2cm and 0.6cm)-(0,5)$),\n1={veclen(\x1,\y1)} in 
   [ressort,decorate, decoration={coil,aspect=0.6,segment length=\n1/36,amplitude=1.5mm}] 
   (0,5)-- ([yshift=1.2mm]\X:2cm and 0.6cm) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
   \draw [ball color=red] 
   (\X:2cm and 0.6cm) circle[radius=0.2cm]; 
   \draw[-{stealth},thick] 
   ({0.3*cos(150)},1.7) arc (150:390:0.3cm and 0.2cm) node[below left=0.4cm] {$\omega$};
   \draw  (0,-0.4)--++(0,5.4); 
  \else
   \draw[-{stealth},thick] 
   ({0.3*cos(150)},1.7) arc (150:390:0.3cm and 0.2cm) node[below left=0.4cm] {$\omega$};
   \draw  (0,-0.4)--++(0,5.4); 
   \draw let \p1=($([yshift=1.2mm]\X:2cm and 0.6cm)-(0,5)$),\n1={veclen(\x1,\y1)} in 
   [ressort,decorate, decoration={coil,aspect=0.6,segment length=\n1/36,amplitude=1.5mm}] 
   (0,5)-- ([yshift=1.2mm]\X:2cm and 0.6cm) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
   \draw [ball color=red] 
   (\X:2cm and 0.6cm) circle[radius=0.2cm]; 
  \fi
  \fill [pattern=north east lines,rotate=0] (-0.5,5) rectangle (0.5,5.3); 
  \draw[thick] (-0.5,5) --++ (1,0); 
\end{tikzpicture}}
\end{animateinline}
\end{center}
\end{document}

으로 보실 수 있습니다 Acrobat Reader. 거기에서 속도를 조절할 수도 있습니다.

tikzlibrary3dtools.code.tex에서 라이브러리를 다운로드하면여기그리고 TeX가 찾을 수 있는 곳에 놓아두면 컴파일할 수 있습니다.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{3dtools,bending,calc,decorations.pathmorphing,patterns}
\begin{document}
\foreach \X in {0,10,...,350}
{\begin{tikzpicture}[scale=1]
  \path[use as bounding box] (-2.5,-0.9) rectangle (2.5,5.5);
  \begin{scope}[3d/install view={theta=70}]
   \path (0,0,5) coordinate (t) (0,0,3.2) coordinate (m) (0,0,0) coordinate (O);
   \path ({1.9*cos(\X)},{1.9*sin(\X)},0.3) coordinate (x)
    ({2*cos(\X)},{2*sin(\X)},0) coordinate (y);
   \begin{scope}[canvas is xy plane at z=0]
    \draw[dotted] circle[radius=2cm];
    \ifnum\X<180
     \draw let \p1=($(x)-(t)$),\n1={veclen(\x1,\y1)} in 
      [decorate,decoration={3d coil color=gray,aspect=0.35, 
      segment length=\n1/108, amplitude=1.5mm,3d complete coil}] 
      (x) -- (t) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
     \begin{scope}
     \pgflowlevelsynccm
     \draw[-{stealth},thick] 
      (m) + (150:0.3) arc (150:390:0.3cm) ;
     \end{scope} 
     \path (m)  node[left,yshift=-1.4cm] {$\omega$};
     \draw[shorten <=-4mm]  (O)--(t); 
    \else
     \begin{scope}
     \pgflowlevelsynccm
     \draw[-{stealth},thick] 
      (m) + (150:0.3) arc (150:390:0.3cm) ;
     \end{scope} 
     \path (m)  node[left,yshift=-1.4cm] {$\omega$};
     \draw[shorten <=-4mm]  (O)--(t); 
     \draw let \p1=($(x)-(t)$),\n1={veclen(\x1,\y1)} in 
      [decorate,decoration={3d coil color=gray,aspect=0.35, 
      segment length=\n1/108, amplitude=1.5mm,3d complete coil}] 
      (x) -- (t) \ifdim\x1>0pt [right=1em] \else [left=1em] \fi node[midway] {$\ell$}; 
    \fi
   \end{scope}
   \path[pattern=north east lines] (-0.5,0,5) rectangle (0.5,0,5.3); 
   \draw[thick] (-0.5,0,5) --++ (1,0,0); 
 \end{scope}
 \path[ball color=red] (y) circle[radius={2.5mm-sin(\X)*0.5mm}];
\end{tikzpicture}}
\end{document}

얻기 위해

여기에 이미지 설명을 입력하세요

관련 정보