\documentclass{book}
\usepackage{lipsum}
\usepackage{tikz}
	\usetikzlibrary{shapes.symbols,calc}
	\tikzstyle{principal} = [starburst,fill=orange!20,draw=red,thick,text=red,scale=1.25]
	\tikzstyle{secondaire} = [starburst,draw=gray,text=gray]
\usepackage{titlesec}
	\titleformat{\chapter}[display]
	{\bfseries\Large\filcenter\fontfamily{lmss}\selectfont}
	{%
	\begin{tikzpicture}[node distance=3cm]
	\clip (-\textwidth/2,-1.6) rectangle +(\textwidth,3.2);
	\ifnum\thechapter=1	
	\drawshadow{\thechapter}
	\foreach\i in {2,3,...,\nbchap}
	{
	\node[secondaire,scale={((\nbchap-\i)+\i*0.5)/\nbchap},right of=chapnum,opacity={1/\i}] (chapnum) {\i};
	}
	\else 
		\ifnum\thechapter<\nbchap
			\drawshadow{\thechapter}
			\pgfmathparse{int(\thechapter+1)}\let\j\pgfmathresult
			\pgfmathparse{int(\thechapter+2)}\let\k\pgfmathresult
			\ifnum\k>\nbchap
				\node[secondaire,scale={((\nbchap-\j)+\j*0.5)/\nbchap},right of=chapnum,opacity={0.5},node distance=4.5cm] (chapnum) {\j};
			\else
			\foreach\i in {\j,\k,...,\nbchap}
			{
				\ifnum\i=\j
				\node[secondaire,scale={((\nbchap-\i)+\i*0.5)/\nbchap},right of=chapnum,opacity={1/\i},node distance=3.5cm] (chapnum) {\i};
				\else
				\node[secondaire,scale={((\nbchap-\i)+\i*0.5)/\nbchap},right of=chapnum,opacity={1/\i}] (chapnum) {\i};
				\fi
			}			
			\fi
			%
			\drawshadow{\thechapter}
			\ifnum\thechapter>2
				\pgfmathparse{int(\thechapter-1)}\let\j\pgfmathresult
				\pgfmathparse{int(\thechapter-2)}\let\k\pgfmathresult
				\foreach\i in {\j,\k,...,1}
				{
					\ifnum\i=\j
					\node[secondaire,scale={((\nbchap-\i)*0.5+\i)/\nbchap},left of=chapnum,opacity={1/(\nbchap-\i)},node distance=3.5cm] (chapnum) {\i};
					\else
					\node[secondaire,scale={((\nbchap-\i)*0.5+\i)/\nbchap},left of=chapnum,opacity={1/(\nbchap-\i)}] (chapnum) {\i};
					\fi
				}
				\else
					\node[secondaire,scale={((\nbchap-1)+0.5)/\nbchap},left of=chapnum,opacity={0.5}] (chapnum) {1};
				\fi
		\else
			\drawshadow{\thechapter}
			\pgfmathparse{int(\thechapter-1)}\let\j\pgfmathresult
			\pgfmathparse{int(\thechapter-2)}\let\k\pgfmathresult
			\foreach\i in {\j,\k,...,1}
			{
				\ifnum\i=\j
				\node[secondaire,scale={((\nbchap-\i)*0.5+\i)/\nbchap},left of=chapnum,opacity={1/(\nbchap-\i)},node distance=3.5cm] (chapnum) {\i};
				\else
				\node[secondaire,scale={((\nbchap-\i)*0.5+\i)/\nbchap},left of=chapnum,opacity={1/(\nbchap-\i)}] (chapnum) {\i};
				\fi
			}
		\fi
	\fi
	\end{tikzpicture}
	}
	{0pt}
	{\Huge}

%%%%% drawshadow

\newcommand{\drawshadow}[1]
{
	\foreach\c/\o in {%
		2/0.1,%
		1.9/0.2,%
		1.8/0.3,%
		1.7/0.4,%
		1.6/0.5}
	{
		\node[starburst,fill=black,scale=\c,opacity=\o] {#1};
	}
	\node[principal] (chapnum) {\thechapter};
}
	
%%%%% Ecrire dans un fichier

\newcommand{\exportnbchapter}[1]{%
\newwrite{\output}
\immediate\openout\output nbchap.txt%
\immediate\write\output{#1}%
\immediate\closeout\output%
}

%%%%% Lire dans un fichier

\makeatletter
\newcount\c@unt%
\newread\monfichier%
\def\lireligne#1 \@nil{%respecter les espaces ici
	\def\nb{#1}%
	}
 
\def\readata#1{%
	\c@unt=0%
    \immediate\openin\monfichier=#1%
    \loop%
    	\advance\c@unt by 1 %
    	\immediate\read\monfichier to \ligne%
        \ifeof\monfichier\else%
        \expandafter\lireligne\ligne\@nil%
        \expandafter\let\csname nbchap\endcsname=\nb%
    \repeat%
    \immediate\closein\monfichier}
\makeatother

\IfFileExists{nbchap.txt}{\readata{nbchap.txt}}{\def\nbchap{20}}


%%%%%

\setlength{\parindent}{0pt}
\begin{document}
\chapter{Quelle belle histoire}

\lipsum

\chapter{Mais qu'est-ce donc ?}

\lipsum

\chapter{Sapristi !}

\lipsum

\chapter{Ventre bleu !}

\lipsum

\chapter{Ouf !}

\lipsum

\chapter{Ainsi soit-il...}

\lipsum

\exportnbchapter{\thechapter}
\end{document}