File:AnimatedPendulum.gif

Original file(626 × 733 pixels, file size: 247 KB, MIME type: image/gif, looped, 18 frames, 3.6 s)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

Description
English: animated pendulum
Deutsch: animiertes Fadenpendel
Date
Source Own work
Author And1mu

Source Code edit

created with LaTeX and PGF/TikZ

Script to create the animation:

#!/bin/bash

set -eu
DIR="animate"
FILE="Pendulum"

NUM=0
rm -f ${DIR}/frame???.png

for ANG in $(seq 0 20 350) ; do
    POS=$(echo "30*c($ANG/45*a(1))" | bc -l)
    echo $POS $ANG
    sed -i "s/\\\def\\\a{.\+}/\\\def\\\a{$POS}/" $FILE.tex
    echo "Creating frame $NUM for $ANG ..."
    pdflatex -shell-escape $FILE.tex 1> /dev/null
    echo "Convert to png ..."
    NUMSTR=$(printf "%03d" $NUM)
    convert -density 300 ${FILE}01.svg -shave 3 ${DIR}/frame${NUMSTR}.png
    NUM=$(($NUM+1))
done
cd $DIR
convert -delay 20 -loop 10000 frame*.png  ${FILE}.gif
cd -

The code to create a single frame:

\documentclass[crop,border=5,tikz,convert={outext=,
  command=\unexpanded{pdf2svg \infile\space\outfile\%02d.svg
    all}},multi=false]{standalone}
\usetikzlibrary{calc,patterns}

\newcommand{\markangle}[6][0.25]{
  \begin{scope}
    \clip (#2)--(#3)--(#4);
    \node (ANG) [draw, circle, minimum size=#5] at (#3){};
  \end{scope}
  \coordinate (E1) at (intersection 0 of ANG and #3--#2);
  \coordinate (E2) at (intersection 0 of ANG and #3--#4);
  \coordinate (EM) at ($ (E1)!0.5!(E2) $);
  \coordinate (EM) at ($ (EM)!#1!(#3) $);
  \node at (EM) {#6};
}

\def\a{-30}

\begin{document}
\begin{tikzpicture}[>=latex,scale=1]
  \fill[white] (-2.5,-5.6) rectangle (2.5,0.3);
  \coordinate (m) at (-90+\a:3);
  \coordinate (maxA) at (-50:3);
  \coordinate (S) at (0,-3.5);
  \coordinate (F) at ($ (0,0)!1.6!(m) $);
  \coordinate (Frad) at ($ (0,0)!1.6!(m) $);
  \coordinate (Ftan) at ($ (m)+(\a:3) $);
  \coordinate (Fel) at ($ (m)+(2,0) $);
  \coordinate (Fg) at ($ (m)+(0,-2) $);
  \fill[pattern = north east lines] (-1,0) rectangle (1,0.3);
  \fill (0,0) circle (0.5mm);
  \draw[color=red,dashed] (maxA) arc (-50:-130:3);
  \draw[semithick,dotted] (0,0)--(S);
  \shade[ball color=gray!50] (m) circle (3mm)
  node[] {$m$};
  \draw[thick] (-1,0)--(1,0);
  \markangle{S}{0,0}{m}{79}{\small $\alpha$}
  \markangle{Fg}{m}{F}{60}{\small $\alpha$}
  \draw[thick,blue!50!black] (0,0)--(m)
  node[midway,fill=white,shift={(-90+\a:0.3)},inner sep=0.8]{\small $l$};
  \draw[thick,->,black!50!green] (m)--(Fg)
  node[below,shift={(0,0.1)}]{\small $m\vec{g}$};
  \draw[thick,black!50!green,->] (m)--($(m)!(Fg)!(Frad)$);
  %node[midway,right]{$\vec{F}_\mathrm{rad}$};
  \draw[semithick,dotted,black!50!green]($(m)!(Fg)!(Ftan)$)--(Fg);
  \draw[semithick,dotted,black!50!green]($(m)!(Fg)!(Frad)$)--(Fg);
  \draw[thick,black!50!green,->] (m)--($(m)!(Fg)!(Ftan)$);
  %node[below,inner sep=1]{$\vec{F}_\mathrm{tan}$};
  \draw[color=red,very thick,<-] (m) arc (-90+\a:-90:3)
  node[midway,above]{\small $x$};
\end{tikzpicture}
\end{document}

Licensing edit

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current16:05, 17 October 2017Thumbnail for version as of 16:05, 17 October 2017626 × 733 (247 KB)And1mu (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: