3

After several unsuccessful tries to reproduce the following post in order to draw this image in gif format:

Philadephia chromosome

I come in desperation, to wonder if it's possible to do the same picture with Tikz environment.

After taking into consideration the answer from marmot, I still can't make the conversion.

Error

Can a benevolent person please do anything that might assist me?

  • 2
    The answer is certainly yes, but do you have the source code for any of the frames? –  Jun 10 '18 at 20:25
  • Precisely, I do not know exactly for writing a part of Tikz for a drawing close to this image. – Furdzik Zbignew Jun 10 '18 at 21:07
  • Well, what have you got? You should be able to do some of it at least. – cfr Jun 10 '18 at 21:31
  • The conversion process in the first answer to the linked question works fine. I can't get the animation to run, but I can never get them to run, so that doesn't mean anything. – cfr Jun 10 '18 at 21:43
  • 1
    As it's not possible to include gif animations in beamer presentations unless you convert them to something else, why not to ask how to draw like something which could be included in beamer? Even more, you've forgotten to mention beamer in your question and it's an important point to be considered. – Ignasi Jun 11 '18 at 08:53
  • @cfr When you are saying that you can't make them run, which viewer are you using? The animations do (also) not run on Preview on MacOS, but they do on the built-in viewers that come with the usual browsers. If you see an animation in my answer, then you have some means, i.e. a browser, that allows you to view animations. I really only uploaded the gif that resulted from the chain in my answer. –  Jun 11 '18 at 17:35

1 Answers1

13

To produce

enter image description here

compile

\documentclass[tikz, border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,decorations.markings}

\begin{document}
\foreach \X in {0,0.05,...,1}
{\begin{tikzpicture}
 %
 \path[use as bounding box](-0.2,-2) rectangle (4.2,3.1);
 \draw[line width=4mm,line cap=round,green!80!black!70!blue] (0,2) -- (0,3);
 \draw[line width=4mm,green!20!black,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,2.2) -- (0,2.8);
 %
 \draw[line width=4mm,line cap=round,green!20!black,Butt Cap-] (0,0) --
 (0,1.6);
 \draw[line width=4mm,green!80!black!70!blue,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,0) -- (0,1.4);
 %
 \draw[line width=4mm,line cap=round,red,Butt Cap-] (1,1.1) --
 (1,1.6);
 \draw[line width=4mm,orange] (1,1.1) -- (1,1.3);
 %
 \draw[line width=1.5mm,orange!50!yellow,rounded corners=5mm,-Triangle,
 postaction={decorate,decoration={markings, mark=at position \X with {%
 \coordinate (first);
 }}},shorten >=10mm] 
 (0,0) -- (0,-1.5) -- (4,-1.5) --  (4,1.8);
 %
 \draw[line width=1.5mm,orange!50!yellow,rounded corners=5mm,-Triangle,
 postaction={decorate,decoration={markings, mark=at position \X with {%
 \coordinate (second);
 }}},shorten >=5mm] 
 (1,1) -- (1,0) --  (3.14,0);
 %
 \begin{scope}[xshift=3cm]
  \draw[line width=4mm,line cap=round,green!20!black,Butt Cap-] (0,0) --
 (0,1.6);
 \draw[line width=4mm,green!80!black!70!blue,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,0) -- (0,1.4);
 %
 \draw[line width=4mm,line cap=round,red,Butt Cap-] (1,1.1) --
 (1,1.6);
 \draw[line width=4mm,orange] (1,1.1) -- (1,1.3);
 \end{scope}
 %
 \begin{scope}[shift={(first)}]
  \draw[line width=4mm,line cap=round,cyan,-Butt Cap] (0,-0.6) --
 (0,0);
 \draw[line width=4mm,orange] (0,-0.15) -- (0,0);
 \draw[line width=4mm,green!20!black] (0,-0.25) -- (0,-0.15);
 \end{scope}
 %
 \begin{scope}[shift={(second)}]
  \draw[line width=4mm,red,line cap=round,red,Butt Cap-] (0,0.1) -- (0,-1);
  \draw[line width=4mm,red!50!black,
  dash pattern=on 3pt off 7pt on 8pt off 5pt on 3pt] (0,0) -- (0,-0.9);
 \end{scope}
\end{tikzpicture}
}   
\end{document}

and then convert with

convert -density 300 -delay 24 -loop 0 -alpha remove multipage.pdf animated.gif

ADENDUM: A beamer version.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,decorations.markings}
\newcount\myangle

\begin{document}
\transduration{2}
\animate<2-22>
\begin{frame}[t,fragile]{Protein}
\animatevalue<2-22>{\myangle}{0}{20}
\begin{tikzpicture}
 \pgfmathsetmacro{\X}{\myangle/21}
 %
 \path[use as bounding box](-0.2,-2) rectangle (4.2,3.1);
 \draw[line width=4mm,line cap=round,green!80!black!70!blue] (0,2) -- (0,3);
 \draw[line width=4mm,green!20!black,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,2.2) -- (0,2.8);
 %
 \draw[line width=4mm,line cap=round,green!20!black,Butt Cap-] (0,0) --
 (0,1.6);
 \draw[line width=4mm,green!80!black!70!blue,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,0) -- (0,1.4);
 %
 \draw[line width=4mm,line cap=round,red,Butt Cap-] (1,1.1) --
 (1,1.6);
 \draw[line width=4mm,orange] (1,1.1) -- (1,1.3);
 %
 \draw[line width=1.5mm,orange!50!yellow,rounded corners=5mm,-Triangle,
 postaction={decorate,decoration={markings, mark=at position \X with {%
 \coordinate (first);
 }}},shorten >=10mm] 
 (0,0) -- (0,-1.5) -- (4,-1.5) --  (4,1.8);
 %
 \draw[line width=1.5mm,orange!50!yellow,rounded corners=5mm,-Triangle,
 postaction={decorate,decoration={markings, mark=at position \X with {%
 \coordinate (second);
 }}},shorten >=5mm] 
 (1,1) -- (1,0) --  (3.14,0);
 %
 \begin{scope}[xshift=3cm]
  \draw[line width=4mm,line cap=round,green!20!black,Butt Cap-] (0,0) --
 (0,1.6);
 \draw[line width=4mm,green!80!black!70!blue,
 dash pattern=on 8pt off 7pt on 3pt off 8pt] (0,0) -- (0,1.4);
 %
 \draw[line width=4mm,line cap=round,red,Butt Cap-] (1,1.1) --
 (1,1.6);
 \draw[line width=4mm,orange] (1,1.1) -- (1,1.3);
 \end{scope}
 %
 \begin{scope}[shift={(first)}]
  \draw[line width=4mm,line cap=round,cyan,-Butt Cap] (0,-0.6) --
 (0,0);
 \draw[line width=4mm,orange] (0,-0.15) -- (0,0);
 \draw[line width=4mm,green!20!black] (0,-0.25) -- (0,-0.15);
 \end{scope}
 %
 \begin{scope}[shift={(second)}]
  \draw[line width=4mm,red,line cap=round,red,Butt Cap-] (0,0.1) -- (0,-1);
  \draw[line width=4mm,red!50!black,
  dash pattern=on 3pt off 7pt on 8pt off 5pt on 3pt] (0,0) -- (0,-0.9);
 \end{scope}
\end{tikzpicture}
\end{frame}   
\end{document}
  • Many thanks in advance for taking the time to solve my problem. However, I forgot to specify that the drawing, in this case, is in a Beamer file. You can look it in my post. – Furdzik Zbignew Jun 11 '18 at 05:58
  • @Furdzik You have to say \usepackage{tikz} above \usetikzlibrary{arrows.meta,decorations.markings}. In standalone, tikz gets loaded because it was added to the options in \documentclass[tikz, border=3.14mm]{standalone}. Notice also that in beamer you can animate \X with the corresponding animate syntax. –  Jun 11 '18 at 11:51
  • Unfortunately, I didn't have the animation despite the modifications made by you. Please take a look at the post above where I put an image of the error message. – Furdzik Zbignew Jun 11 '18 at 12:51
  • @Furdzik You have to load tikz but also needed libraries \usetikzlibrary{arrows.meta, decorations.markings} as in marmot's code. – Ignasi Jun 11 '18 at 13:35
  • I can't do the conversion. Please take a look at the image embedded in the initial message. – Furdzik Zbignew Jun 11 '18 at 15:12
  • @Furdzik I added a beamer version. You need to use acroread in the fullscreen mode to view it, I believe. –  Jun 11 '18 at 15:59
  • @marmot Thanks for the Beamer version. How to run the code: convert -density 300 -delay 24 -loop 0 -alpha remove multipage.pdf animated.gif The problem is still not solved. – Furdzik Zbignew Jun 11 '18 at 16:44
  • @Furdzik You can either run the first code (with document class standalone) to get a multipage pdf document that you can convert as described or use the beamer thing in which you obviously do not need any conversion since beamer will do the animation. –  Jun 11 '18 at 16:49
  • Once again, thank you very much for your help. – Furdzik Zbignew Jun 11 '18 at 20:45
  • @Furdzik You're welcome! BTW, if it works for you now, perhaps you want to modify the last part of your question... –  Jun 11 '18 at 21:07