如何填充 visualcounter 倒计数器?

如何填充 visualcounter 倒计数器?

我正在尝试填满countdown柜台以获得类似的东西

在此处输入图片描述

但我没能得到它

\usemodule[visualcounter]

\startTEXpage
  \usevisualcounter[n=0,last=4,distance=0pt]{countdown}
  \usevisualcounter[n=1,last=4,heigth=20pt,distance=0pt]{countdown}
  \usevisualcounter[n=2,last=4,heigth=20pt,width=15pt,distance=0pt]{countdown}
  \usevisualcounter[n=2,last=4,heigth=20pt,width=20pt,distance=0pt]{countdown}
  \usevisualcounter[n=3,last=4,heigth=20pt,width=15pt,maxtext=0pt,distance=0pt]{countdown}
  \usevisualcounter[n=3,last=4,heigth=20pt,width=0pt,maxtext=0pt,distance=0pt]{countdown}
  \usevisualcounter[n=3,last=4,heigth=20pt,width=20pt,maxtext=20pt,distance=0pt]{countdown}
\stopTEXpage

在此处输入图片描述

我想这可能是因为我不明白如何使用maxtext文档并没有真正帮助我这个。

答案1

定义自己的计数器相对简单。这是一次尝试,用单一颜色绘制所有内容(我使用past_color)。

\usemodule[visualcounter]

\startuseMPgraphic{visualcounter::fullcircle}
  begingroup ;

  \includeMPgraphic{visualcounter::initialization}

  newnumeric diameter ;
  diameter := max(width, height) ;

  newpath inner_circle;
  % make the circle start at 12 o'clock and go clockwise 
  inner_circle := reverse (fullcircle scaled diameter) rotated 90;

  % step size
  newnumeric inner_time;
  inner_time := arclength (inner_circle)/last_counter ;

  newpath slice ;

  newpair start_pt, stop_pt;

  start_pt := point 0 on inner_circle;
  stop_pt  := point(current_counter*inner_time) on inner_circle;

  slice := inner_circle cutbefore start_pt cutafter stop_pt
     --- origin --- cycle ;

  draw inner_circle withpen pencircle scaled rulethickness withcolor past_color;
  fill slice withcolor past_color ;

  endgroup ;

\stopuseMPgraphic

\definevisualcounter
  [fullcircle]
  [         
    mp=visualcounter::fullcircle,
    width=2cm,
    height=2cm,
    rulethickness=4bp,
  ]

\starttext

\usevisualcounter[n=1,last=10]{fullcircle}
\usevisualcounter[n=3,last=10]{fullcircle}
\usevisualcounter[n=5,last=10]{fullcircle}
\usevisualcounter[n=7,last=10]{fullcircle}
\usevisualcounter[n=9,last=10]{fullcircle}

\stoptext

这使

在此处输入图片描述

相关内容