略作尝试,还得靠你自己微调。
\documentclass[border=8pt]{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{xfp}
\begin{document}
\newcommand*{\threerectangles}[2]{
\pgfmathsetmacro\x{\fpeval{#1+0.64*(#2-#1)}}
\pgfmathsetmacro\y{\fpeval{0+0.48*(#2-#1)}}
\tkzDefPoints{#1/0/A,#2/0/B,\x/\y/C}
% \tkzDrawPolygon(A,B,C)
\tkzDefSquare(B,A) \tkzDrawPolygon(B,A,tkzFirstPointResult,tkzSecondPointResult)
\tkzDefSquare(A,C) \tkzDrawPolygon(A,C,tkzFirstPointResult,tkzSecondPointResult)
\tkzDefSquare(C,B) \tkzDrawPolygon(C,B,tkzFirstPointResult,tkzSecondPointResult)
}
% https://tex.stackexchange.com/questions/164476/how-to-add-a-global-before-pgfmathsetmacro
\begin{tikzpicture}
\pgfmathsetmacro\posa{0}
\pgfmathsetmacro\posb{5}
\foreach \i in {1,...,5}{
\threerectangles{\posa}{\posb}
\pgfmathsetmacro\tmp{\posb}
\pgfmathparse{\fpeval{\tmp+0.6*(\tmp-\posa)*1.25}}
\global\let\posb\pgfmathresult
\global\let\posa\tmp
% \node at (\i,\i) {(\posa,\posb,\tmp)};
}
\end{tikzpicture}
\end{document}