5

I wanted to have a simple way of showing moving atoms within a molecule structure. I was inspired by this website: http://chem.libretexts.org. Here's one example of how to create that. Others may add more examples later on.

  • Oh, a call for an animate showcase? I am flattered :-). – AlexG Jan 13 '17 at 8:36
  • Yes, that's the price you'll have to pay for giving me so much help! :-) – Jimmy Westberg Jan 13 '17 at 9:00
  • 2
    Wow, just realized you're the developer behind animate! I love it a ton. – Jimmy Westberg Jan 13 '17 at 9:15
6
%
\documentclass[12pt]{article}
\usepackage[loop,palindrome,autoplay]{animate}
\usepackage{chemfig}

\begin{document}

\begingroup
\setatomsep{3em}
\centering
Symmetric stretching

\newline

\begin{animateinline}[begin={\begin{minipage}[c][3em][c]{8em}}, end={\end{minipage}}]{3}
\noindent\makebox[\textwidth][c]{
\chemfig{C(=[:-180,1.2]O)(=[:0,1.2]O)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(=[:-180,0.95]O)(=[:0,0.95]O)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(=[:-180,0.65]O)(=[:0,0.65]O)}
}
\end{animateinline}

Antisymmetric stretching

\newline

\begin{animateinline}[begin={\begin{minipage}[c][3em][c]{8em}}, end={\end{minipage}}]{3}
\noindent\makebox[7em][c]{
\chemfig{C(=[:-180,1.25]O)(=[:0,0.75]O)}
}
\newframe
\noindent\makebox[8em][c]{
\chemfig{C(=[:-180,1]O)(=[:0,1]O)}
}
\newframe
\noindent\makebox[9em][c]{
\chemfig{C(=[:-180,0.7]O)(=[:0,1.2]O)}
}
\end{animateinline}

Scissoring (bending)

\newline

\begin{animateinline}[begin={\begin{minipage}[c][6em][c]{8em}}, end={\end{minipage}}]{3}
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-30]H)(-[:30]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-45]H)(-[:45]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-60]H)(-[:60]H)}
}
\end{animateinline}

Rocking

\newline

\begin{animateinline}[begin={\begin{minipage}[c][5em][c]{8em}}, end={\end{minipage}}]{3}
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:30]H)(-[:90]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:0]H)(-[:60]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-30]H)(-[:30]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-60]H)(-[:0]H)}
}
\newframe
\noindent\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-90]H)(-[:-30]H)}
}
\end{animateinline}

Wagging

\newline

\begin{animateinline}[begin={\begin{minipage}[c][7em][c]{8em}}, end={\end{minipage}}]{3}
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<[:-30,1.5]{\mbox{\Huge H}})(<[:30,1.5]{\mbox{\Huge H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<[:-30,1.25]{\mbox{\Large H}})(<[:30,1.25]{\mbox{\Large H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-30]{\mbox{\normalsize H}})(-[:30]{\mbox{\normalsize H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<:[:-30]{\mbox{\footnotesize H}})(<:[:30]{\mbox{\footnotesize H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<:[:-30]{\mbox{\tiny H}})(<:[:30]{\mbox{\tiny H}})}
}
\end{animateinline}


Twisting

\newline

\begin{animateinline}[begin={\begin{minipage}[c][6em][c]{8em}}, end={\end{minipage}}]{3}
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<[:-30,1.5]{\mbox{\Huge H}})(<:[:30]{\mbox{\tiny H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<[:-30,1.25]{\mbox{\Large H}})(<:[:30]{\mbox{\footnotesize H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(-[:-30]{\mbox{\normalsize H}})(-[:30]{\mbox{\normalsize H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<:[:-30]{\mbox{\footnotesize H}})(<[:30,1.25]{\mbox{\Large H}})}
}
\newframe
\makebox[\textwidth][c]{
\chemfig{C(<[:165])(<:[:195])(<:[:-30]{\mbox{\tiny H}})(<[:30,1.5]{\mbox{\Huge H}})}
}
\end{animateinline}

\endgroup
\end{document}

Output example

OutputExample

  • 2
    The code compiles only if I comment out the \newlines. – AlexG Jan 13 '17 at 11:20
2

Well, this answer involves chemistry after a fashion...and its concomitant influence on biology. And I didn't even need to use chemfig.

Anyone with a teenage daughter can relate...

\documentclass[12pt]{article}
\usepackage[loop,palindrome,autoplay]{animate}
\usepackage{stackengine}
\begin{document}
\char80\char77\char83:
\begin{animateinline}[begin={\begin{minipage}[c][6em]{12em}}, end={\end{minipage}}]{3}
\noindent\makebox[\textwidth][c]{
\stackinset{c}{}{c}{-1.0pt}{\scalebox{2.4}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{-1.5pt}{\scalebox{2.0}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{1pt}{\scalebox{.5}{$\circ$}\,\scalebox{.5}{$\circ$}}{%
\stackinset{c}{}{c}{-3pt}{\scalebox{1}[.9]{$\circ$}}{%
  \LARGE\sffamily O}}}}
}
\newframe
\noindent\makebox[\textwidth][c]{
\stackinset{c}{}{c}{-1.0pt}{\scalebox{2.4}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{-1.5pt}{\scalebox{2.0}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{1pt}{\scalebox{.3}{$\circ$}\,\scalebox{.3}{$\circ$}}{%
\stackinset{c}{}{c}{-3pt}{\scalebox{1}[.7]{$\circ$}}{%
  \LARGE\sffamily O}}}}
}
\newframe
\noindent\makebox[\textwidth][c]{
\stackinset{c}{}{c}{-1.0pt}{\scalebox{2.4}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{-1.5pt}{\scalebox{2.0}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{1pt}{..}{%
\stackinset{c}{}{c}{-3pt}{\scalebox{1}[.5]{$\circ$}}{%
  \LARGE\sffamily O}}}}
}
\newframe
\noindent\makebox[\textwidth][c]{
\stackinset{c}{}{c}{-1.0pt}{\scalebox{2.4}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{-1.5pt}{\scalebox{2.0}[2.6]{$\cap$}}{%
\stackinset{c}{}{c}{1pt}{..}{%
\stackinset{c}{}{c}{-3pt}{-}{%
  \LARGE\sffamily O}}}}
}
\end{animateinline}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.