Posts tagged ‘TikZ’

## Animating TikZ Graphics

After drawing the cubic Bezier a few days ago I wanted to animate it. Using the animate package this is fairly simple:

 \documentclass{article} \usepackage[paperwidth=5.5cm,paperheight=5.3cm,left=0cm,right=0cm,bottom=0cm,top=0.25cm]{geometry} \usepackage{tikz} \definecolor{fom}{RGB}{0,153,139}   \newcommand{\dat}{0.7} % 0.67 \usepackage{animate}   \begin{document}   \begin{animateinline}[poster=last, controls, palindrome]{10} \multiframe{70}{Ry=0.1+0.01}{ \begin{tikzpicture}[x=4cm,y=4cm] \draw[line width=1pt,lightgray] (0,0) -- (1,1); \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- (0,0); \draw (0,0) -- (0.17,0.67); \draw (1,1) -- (0.83,\Ry);   \draw [magenta,fill=magenta](0.17,0.67) circle (.5ex); \draw [fom,fill=fom](0.83,\Ry) circle (.5ex);   \draw[line width=1pt] (0,0) .. controls (0.17,0.67) and (0.83,\Ry) .. (1,1);   \node[label={[label distance=0.0cm,text depth=-1ex,rotate=90]left:Fortschritt in \%}] at (-0.1,.8) {}; \node[label={[label distance=0.0cm,text depth=-1ex]right:Zeit-Achse}] at (0,-0.05) {}; \end{tikzpicture}} \end{animateinline}   \end{document}

I am animating in the TeX code (not externally) so I use animateinline with 10 frames per second. Inside this environment I prepare 70 frames, where I have the y-coordinate of the second point loop from 0.1 in steps of 0.01. The looping is controlled via Ry (that translates to \Ry in the loop). That’s it!

Here is the resulting PDF: bezier

PS: I used pdflatex from the TeX Live 2014.

### Uwe

Uwe Ziegenhagen has been working with LaTeX for more than a decade. Besides TeX/LaTeX he likes to work with Python, Rasberry/Arduino and his digital camera.

## Drawing Bezier Curves with TikZ

To visualize an example for cubic-Bezier CSS animations (http://cubic-bezier.com) I decided to try TikZ. That was in fact a pretty good idea, as — with the help of Google (and mostly tex.stackexchange.com) I managed to complete the following example in just a few minutes:

 \documentclass{article} \usepackage[paperwidth=5.5cm,paperheight=5.3cm,left=0cm,right=0cm,bottom=0cm,top=0.25cm]{geometry} \usepackage{tikz} \definecolor{fom}{RGB}{0,153,139} \begin{document}   \begin{tikzpicture}[x=4cm,y=4cm] \draw[line width=1pt,lightgray] (0,0) -- (1,1); % gray line for the linear animation path \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- (0,0); % frame \draw (0,0) -- (0.17,0.67); % (0,0) to 2. point \draw (1,1) -- (0.83,0.67); % (1,1) to 3. point   \draw [magenta,fill=magenta](0.17,0.67) circle (.5ex); %circle 1 \draw [fom,fill=fom](0.83,0.67) circle (.5ex); % circle 2   \draw[line width=1pt] (0,0) .. controls (0.17,0.67) and (0.83,0.67) .. (1,1); % cubic bezier curve   % labels \node[label={[label distance=0.0cm,text depth=-1ex,rotate=90]left:Fortschritt in \%}] at (-0.1,.8) {}; \node[label={[label distance=0.0cm,text depth=-1ex]right:Zeit-Achse}] at (0,-0.1) {}; \end{tikzpicture} \end{document}

The result is pretty impressive.

### Uwe

Uwe Ziegenhagen has been working with LaTeX for more than a decade. Besides TeX/LaTeX he likes to work with Python, Rasberry/Arduino and his digital camera.

## Creating an Overview of BABOK Knowledge Areas with LaTeX

Last week I attended a CBAP preparation course (materials from http://www.watermarklearning.com/cbap, held by http://www.masventa.eu). To prepare myself for the exam I created an overview of all knowledge areas using TikZ’s magnificient graphics functions. Together with a little ifdraft magic I got a nice file.

Area_Summary_landscape (PDF, DIN A4 landscape)