その他一覧へ戻る

バネ(パラパラ漫画)

鉄TeX機能紹介/TikZサンプル/バネ(パラパラ漫画).tex鉄TeX機能紹介 / TikZhybrid

レンダリング結果

361ページ / 同名PDFあり
バネ(パラパラ漫画) preview
バネ(パラパラ漫画) preview
バネ(パラパラ漫画) preview

先頭3ページのみプレビューしています。

PDFを開く
TeXソース
TeXソース
入力コード
\documentclass[a5j,10pt,twoside]{tetsujsarticle}
\usepackage{tetsuryoku}
\begin{document}

\def\屋根の厚み{0.2}
\def\屋根の高さ{7}
\def\振幅{4}


\fornext<t>[0]{720}(2){%
\edef\t{\arabic{t}}
\noindent 
\begin{tikzpicture}
%% 屋根
\coordinate (屋根の左下) at (-0.5,\屋根の高さ);
\coordinate (屋根の右上) at ($(屋根の左下) + (1,\屋根の厚み)$);
\fill [pattern = north east lines] (屋根の左下) rectangle (屋根の右上);
\draw[thick] (屋根の左下) -- (屋根の右上 |- 屋根の左下);
%% 円
\coordinate (円の中心) at (3 + \振幅,0);
\draw[line width=2pt,color=blue] (円の中心) circle[radius=\振幅];
% おもり
\node[circle,shade,outer color=black!90!white,inner color=white,inner sep=2.5mm] (a) at (0,{\振幅*sin(\t)}) {};
% バネ
\FPeval\a{2-sin(\t*3.14/180)}
\coordinate (b) at (a |- 屋根の左下);
\draw[decoration={aspect=0.4, segment length=\a mm, amplitude=2mm,coil},decorate]  ($(b) + (0,-2mm)$) -- ($(a.north) + (0,1mm)$);%% バネ
\draw ($(b) + (0,-2mm)$) -- (b) %% 屋根とバネを接続する直線部
($(a.north) + (0,1mm)$) -- (a)  %% おもりとバネを接続する直線部
;
%% 円上のおもり
\node[circle,shade,outer color=black!90!white,inner color=white,inner sep=2.5mm] (c) at ($(円の中心) + ({\振幅*cos(\t)},{\振幅*sin(\t)})$) {};
\draw[-stealth,color=red,line width=2pt] (円の中心) -- (c);
%% 点線
\begin{scope}[on background layer]
\draw[dotted, line width=1pt,color=black!50!white] (a) -- (c);
\end{scope}
\end{tikzpicture}
\newpage
}

\end{document}