Skip to content

Circle Timer ​

A countdown ring with 25/50/75/100 tick marks and a remaining-seconds readout.

a-sxr-circle-timer Component ​

Properties ​

PropertyDescriptionDefault Value
font-sizeFont size for countdown text0.2
font-familyFont family for progress countdown textOutfit-Regular.ttf
font-colorText color for progress countdown text#F1F5F9
border-colorColor of indicators that show 25/50/75/100 progress#1B1B1F
background-colorBackground color of item#202127
active-colorColor of ring that indicates countdown progress#2563EB
count-downInitial countdown value in seconds10
callbackName of a global function that fires when countdown expires''
widthWidth of item1
heightHeight of item1
marginMargin around item0 0 0 0
html
<a-sxr-circle-timer
	height="0.75"
	count-down="60"
	callback="timedout"
	font-family="Outfit-Regular.woff2"
	margin="0 0 0.1 0"
>
</a-sxr-circle-timer>

Countdown ​

Set the starting duration in seconds with count-down. The ring drains once the scene loads.

js
const timer = document.querySelector('a-sxr-circle-timer')
timer.setAttribute('count-down', '30')

Expiry callback ​

callback names a global function invoked when the countdown reaches zero. The callback takes no arguments:

js
function timedout() {
  console.log('time is up')
}

Prefer events

Global callbacks must exist on window before the scene loads — a typo silently no-ops. Alternatively, listen for the widget's own events. See Interaction.

Tick marks ​

border-color paints the 25/50/75/100% indicator marks around the ring. Use a contrasting color when the ring needs quick quarter readings.