I want to add animation to following graphic created in tikz environment. The desired sequence is 1 2 3 1 2 3 2......

  1. Block $\mathcal{C}_1^{-1}$ turns green AND digit:1 appears in green below the figure.
  2. Block $\mathcal{C}_2^{-1}$ turns red AND digit:2 appears next to digit:1(in green) in red
  3. Block $\mathcal{C}_3^{-1}$ turns blue AND digit:3 appears next to 1(in red) and 2(in green) in blue

In short, I want the sequence, in multicolor, to appear at bottom of figure.

Complete code for figure is (This code has block highlighting part):

\usetikzlibrary{arrows,  calc, chains, positioning, quotes}
\newcommand\ppbb{path picture bounding box}
\tikzset{shorten <>/.style = {shorten >=#1, shorten <=#1},
dot/.style = {circle, fill=black,
            inner sep=0mm, outer sep=0mm, minimum size=0.1mm,
            node contents={}},
sum/.style = {circle, draw=black, fill=white, minimum size=6mm,
           path picture={\draw[very thick,shorten <>=1mm,-]
           (\ppbb.north) edge (\ppbb.south)
           (\ppbb.west)  edge  (\ppbb.east);
            },% end of node contents
            node contents={}},
onslide/.code args={<#1>#2}{\only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
      %draw,rectangle,rounded corners=3,minimum width=2cm,text width=1.8cm,text centered     
    node distance = 16 mm and 9 mm,
      start chain = going right,
      base/.style = {draw, rectangle, 
                     inner sep=1mm, outer sep=0mm, minimum width=1cm,
    cblock/.style = {base, minimum height=8mm, on chain},
    sblock/.style = {base, minimum height=8mm},
    lblock/.style = {base,minimum height=18mm},
         X/.style = {font=\scriptsize},
every edge/.style = {draw,X}
% first row (from left to right)                     
\coordinate[on chain] (in) at (0,0);
\node (c3)  [cblock]    {$\mathcal{C}_{3}$};
\node (pi2) [cblock]    {$\pi_2$};
\node (c2)  [cblock]    {$\mathcal{C}_2$};
\node (pi1) [cblock]    {$\pi_1$};
\node (c1)  [cblock]    {$\mathcal{C}_1$};% is there \matcal{M}?
% second row (from right to left)
\node (c1i)     [lblock, onslide={<1,4>{green}}, below = of c1] {$\mathcal{C}_1^{-1}$};
\node (pi1i)    [sblock, below = of pi1]        {$\pi_1^{-1}$};
\node (pi12)    [sblock, below = 2mm of pi1i]   {$\pi_1$};
\node (c2i)     [lblock, onslide={<2,5>{red}},   below = of c2] {$\mathcal{C}_2^{-1}$};
\node (pi2i)    [sblock, below = of pi2]        {$\pi_2^{-1}$};
\node (pi22)    [sblock, below = 2mm of pi2i]   {$\pi_2$};
\node (c3i)     [lblock, onslide={<3,6>{blue}},  below = of c3] {$\mathcal{C}_{3}^{-1}$};
\coordinate[left=of c3i] (out);
% summation
\node (s1)  [sum, right=of $(c1.south)!0.5!(c1i.north)$];
% lines in the first row 
\draw[-stealth] (in)    edge["$\bm{x_3}$"]  (c3) 
                (c3)    edge["$\bm{y_3}$"]  (pi2)
                (pi2)   edge["$\bm{x_2}$"]  (c2) 
                (c2)    edge["$\bm{y_2}$"]  (pi1)
                (pi1)   to  [X,"$\bm{x_1}$"]   (c1);
% lines at sum
\draw [-stealth] (c1)    -| node[X,above,pos=0.25] {$\bm{s}$} (s1);
\draw [-stealth] (c1 |- s1) -- node[X,above] {$\bm{w}$} (s1);
\draw [-stealth] (s1)    |- node[X,above,pos=0.75] {$\bm{r}$} (c1i);
% lines in the second row (from right to left, above)
\draw[-stealth] (c1i.west |- pi1i)  edge["$E{(\bm{x_1})}$" ']  (pi1i) 
                (pi1i)              edge["$A{(\bm{y_2})}$" ']  (c2i.east |- pi1i) 
                (c2i.west |- pi2i)  edge["$E{(\bm{x_2})}$" ']  (pi2i) 
                (pi2i)              edge["$A{(\bm{y_3})}$" ']  (c3i.east |- pi2i)
                (c3i)                to [X,"$E{(\bm{x_3})}$" ']  (out);
% lines in the second row (from left to right, below)
\draw[-latex]   (c3i.east |- pi22)  edge["$E(\bm{y_2})$"]   (pi22)
                (pi22)              edge["$A(\bm{x_2})$"]  (pi22 -| c2i.west)
                (c2i.east |- pi12)  edge["$A(\bm{y_2})$"]  (pi12)
                (pi12)              to [X,"$E(\bm{x_3})$"]  (pi12 -| c1i.west);

Update: I have created 6 slides. In each slide only one block is highlighted. However I don't know how to display block sequence at the bottom of slide.



2/1 2

3/1 2 3

4/1 2 3 1

5/1 2 3 1 2

6/1 2 3 1 2 3



Browse other questions tagged .