% !TEX TS-program = ConTeXt2021

\startuseMPgraphic{base}
    picture p[];
    path TheFrame ;
    TheFrame := fullsquare scaled 5in ;
    
    %let's define the commonly used geometry elements
    
    z1 = (60,40);
    z2 = (40,90);
    z3 = (10,70);
    
    %let's define some layers with drawn content

    p1:=image(
    label("Word 1", z1);
    );

    p2:=image(
    label("Mot 2", z2);
    );

    p3:=image(
    label("Parola 3", z3);
    );
    
    p4:=image(
    label("Wort 4", z3+z1);
    );

    p5:=image(
    label("Nummer 5", z2+z3);
    );
    
    p6:=image(
    label("number 6", z2+z1);
    );

    \stopuseMPgraphic

    \starttext

    \dorecurse{6}{ % Frame
	\ifnum 
            \recurselevel = 3 %this defines the page which will be skipped. This solution allows only one page to be skipped. 
	\else
            \startMPpage[pagestate=start]
        
            \includeMPgraphic{base}
        
            currentime := #1 ;
            % Just for learning :
            draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
            draw textext("T="&decimal(currentime)) shifted(0,2in)
            withcolor magenta ;
            boolean b[]; 
            %in the following lines b[] := , we define the images which should not be added to currentpicture:
            b[3] := true; 
            b[5] := true;
            for k=1 upto currentime: 
            if known b[k] :
            else :
            addto currentpicture also p[k]; 
            fi
            endfor
            setbounds currentpicture to TheFrame ;
        
            desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
            currentpicture := currentpicture xysized (desiredformat ,desiredformat );
        
            \stopMPpage
        \fi
    }

    \stoptext
