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.

More Posts - Website

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.

bez

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.

More Posts - Website

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)

\documentclass[fontsize=10pt]{scrartcl}
\usepackage[a4paper,landscape,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
 
\usepackage[]{ifdraft}
\usepackage[]{attachfile}
\usepackage[]{eso-pic}
 
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
 
\renewcommand{\familydefault}{\sfdefault}
\RequirePackage[scaled=0.9]{helvet}
\usepackage{tikz}
\usepackage[right]{showlabels}
\usetikzlibrary{positioning}
\pagestyle{empty}
 
\usepackage{xcolor}
 
\ifdraft{
\definecolor{mycol}{RGB}{255,255,255}
}{%
\definecolor{mycol}{RGB}{0,0,0}
}
 
\usepackage{hyperref}
\usepackage[]{url}
 
\hypersetup{% 
  pdftitle={CBAP Knowledge Areas},
  pdfauthor={Uwe Ziegenhagen, uwe.ziegenhagen@db.com	},
  pdfsubject={Babok Knowledge Areas},
  pdfkeywords={Babok, CBAP, Knowledge Areas}
}
 
\newcommand{\file}[1]{\textattachfile{#1}{\textcolor{blue}{\LaTeX\ Sourcecode}}}
 
\begin{document}  
 
\AddToShipoutPictureFG*{
  \put(35,25){\footnotesize Uwe Ziegenhagen, uwe.ziegenhagen@db.com, \file{\jobname.tex}	
}
}
 
\begin{center}
\begin{tikzpicture}
[
    x=40mm,y=25mm,
    mybox/.style={rectangle,rounded corners,xshift=1cm,yshift=1cm,minimum width=35mm, minimum height=22.5mm},
    topline/.style={mybox,mycol,align=center,draw=red,very thick,font=\bfseries},
    botline/.style={mybox,mycol,align=center,draw=orange,very thick,font=\bfseries},
    yelline/.style={mybox,mycol,align=center,draw=cyan,very thick,font=\bfseries},
    pinkline/.style={mybox,mycol,align=center,draw=violet,very thick,font=\bfseries}
]
\node at (0,0) [topline] {Business Analysis \\ Planning  \& \\ Monitoring};
\node at (1,0) [topline] {Elicitation};
\node at (2,0) [topline] {Requirements \\ Management \&  \\ Communications};
\node at (3,0) [topline] {Enterprise Analysis};
\node at (4,0) [topline] {Requirements \\ Analysis};
\node at (5,0) [topline] {Solution Assessment \\ \& Validation};
\node at (6,0) [topline] {Underlying  \\ Competencies};
 
\node at (0,-1) [botline] {Plan BA Approach};
\node at (0,-2) [botline] {Conduct \\ Stakeholder \\ Analysis};
\node at (0,-3) [botline] {Plan BA Activities};
\node at (0,-4) [botline] {Plan BA \\ Communication};
\node at (0,-5) [botline] {Plan Requirements \\ Management \\ Process};
\node at (0,-6) [botline] {Manage BA \\ Performance};
 
\node at (1,-1) [yelline] {Prepare for \\ Elicitation};
\node at (1,-2) [yelline] {Conduct \\ Elicitation \\ Activity};
\node at (1,-3) [yelline] {Document \\ Elicitation \\ Results};
\node at (1,-4) [yelline] {Confirm \\ Elicitation \\ Results};
 
\node at (2,-1) [botline] {Manage Solution \\ Scope \& \\ Requirements};
\node at (2,-2) [botline] {Manage \\ Requirements \\ Traceability};
\node at (2,-3) [botline] {Maintain \\ Requirements \\ for Re-Use};
\node at (2,-4) [botline] {Prepare \\ Requirements \\ Package};
\node at (2,-5) [botline] {Communicate \\ Requirements};
 
\node at (3,-1) [yelline] {Define \\ Business \\ Need};
\node at (3,-2) [yelline] {Assess \\ Capability \\ Gaps};
\node at (3,-3) [yelline] {Determine \\ Solution \\ Approach};
\node at (3,-4) [yelline] {Define \\ Solution \\ Scope};
\node at (3,-5) [yelline] {Define \\ Business \\ Case};
 
\node at (4,-1) [botline] {Prioritize \\ Requirements};
\node at (4,-2) [botline] {Organize \\ Requirements};
\node at (4,-3) [botline] {Specify \& \\ Model \\ Requirements};
\node at (4,-4) [botline] {Define \\ Assumption \& \\ Constraints};
\node at (4,-5) [botline] {Verify \\ Requirements };
\node at (4,-6) [botline] {Validate \\ Requirements};
 
\node at (5,-1) [yelline] {Assess \\ Proposed \\ Solution};
\node at (5,-2) [yelline] {Allocate \\ Requirements};
\node at (5,-3) [yelline] {Assess \\ Organizational \\ Readiness};
\node at (5,-4) [yelline] {Define \\ Transition \\ Requirements};
\node at (5,-5) [yelline] {Validate \\ Solution};
\node at (5,-6) [yelline] {Evaluate \\ Solution \\ Performance};
 
\node at (6,-1) [pinkline] {Analytical \\ Thinking \& Problem \\ Solving };
\node at (6,-2) [pinkline] {Behavioral \\ Characteristics};
\node at (6,-3) [pinkline] {Business \\ Knowledge};
\node at (6,-4) [pinkline] {Communication \\ Skills};
\node at (6,-5) [pinkline] {Interaction \\ Skills};
\node at (6,-6) [pinkline] {Software \\ Applications};
\end{tikzpicture}
\end{center}
 
\ifdraft{%
}{%
\definecolor{mycol}{RGB}{255,255,255}
\begin{center}
\begin{tikzpicture}
[
    x=40mm,y=25mm,
    mybox/.style={rectangle,rounded corners,xshift=1cm,yshift=1cm,minimum width=35mm, minimum height=22.5mm},
    topline/.style={mybox,mycol,align=center,draw=red,very thick,font=\bfseries},
    botline/.style={mybox,mycol,align=center,draw=orange,very thick,font=\bfseries},
    yelline/.style={mybox,mycol,align=center,draw=cyan,very thick,font=\bfseries},
    pinkline/.style={mybox,mycol,align=center,draw=violet,very thick,font=\bfseries}
]
\node at (0,0) [topline] {Business Analysis \\ Planning  \& \\ Monitoring};
\node at (1,0) [topline] {Elicitation};
\node at (2,0) [topline] {Requirements \\ Management \&  \\ Communications};
\node at (3,0) [topline] {Enterprise Analysis};
\node at (4,0) [topline] {Requirements \\ Analysis};
\node at (5,0) [topline] {Solution Assessment \\ \& Validation};
\node at (6,0) [topline] {Underlying  \\ Competencies};
 
\node at (0,-1) [botline] {Plan BA Approach};
\node at (0,-2) [botline] {Conduct \\ Stakeholder \\ Analysis};
\node at (0,-3) [botline] {Plan BA Activities};
\node at (0,-4) [botline] {Plan BA \\ Communication};
\node at (0,-5) [botline] {Plan Requirements \\ Management \\ Process};
\node at (0,-6) [botline] {Manage BA \\ Performance};
 
\node at (1,-1) [yelline] {Prepare for \\ Elicitation};
\node at (1,-2) [yelline] {Conduct \\ Elicitation \\ Activity};
\node at (1,-3) [yelline] {Document \\ Elicitation \\ Results};
\node at (1,-4) [yelline] {Confirm \\ Elicitation \\ Results};
 
\node at (2,-1) [botline] {Manage Solution \\ Scope \& \\ Requirements};
\node at (2,-2) [botline] {Manage \\ Requirements \\ Traceability};
\node at (2,-3) [botline] {Maintain \\ Requirements \\ for Re-Use};
\node at (2,-4) [botline] {Prepare \\ Requirements \\ Package};
\node at (2,-5) [botline] {Communicate \\ Requirements};
 
\node at (3,-1) [yelline] {Define \\ Business \\ Need};
\node at (3,-2) [yelline] {Assess \\ Capability \\ Gaps};
\node at (3,-3) [yelline] {Determine \\ Solution \\ Approach};
\node at (3,-4) [yelline] {Define \\ Solution \\ Scope};
\node at (3,-5) [yelline] {Define \\ Business \\ Case};
 
\node at (4,-1) [botline] {Prioritize \\ Requirements};
\node at (4,-2) [botline] {Organize \\ Requirements};
\node at (4,-3) [botline] {Specify \& \\ Model \\ Requirements};
\node at (4,-4) [botline] {Define \\ Assumption \& \\ Constraints};
\node at (4,-5) [botline] {Verify \\ Requirements };
\node at (4,-6) [botline] {Validate \\ Requirements};
 
\node at (5,-1) [yelline] {Assess \\ Proposed \\ Solution};
\node at (5,-2) [yelline] {Allocate \\ Requirements};
\node at (5,-3) [yelline] {Assess \\ Organizational \\ Readiness};
\node at (5,-4) [yelline] {Define \\ Transition \\ Requirements};
\node at (5,-5) [yelline] {Validate \\ Solution};
\node at (5,-6) [yelline] {Evaluate \\ Solution \\ Performance};
 
\node at (6,-1) [pinkline] {Analytical \\ Thinking \& Problem \\ Solving };
\node at (6,-2) [pinkline] {Behavioral \\ Characteristics};
\node at (6,-3) [pinkline] {Business \\ Knowledge};
\node at (6,-4) [pinkline] {Communication \\ Skills};
\node at (6,-5) [pinkline] {Interaction \\ Skills};
\node at (6,-6) [pinkline] {Software \\ Applications};
\end{tikzpicture}
\end{center}}
 
\end{document}

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.

More Posts - Website