sync on : sync rate 0
hide mouse
 
`Set text font
set text font "Comic Sans MS"
set text size 10
 
`Colors
Colors = 7
 
`Constant color (1 = red, 2 = green, 3 = blue)
dim Color(Colors, 3)
Color(1, 1) = 255 : Color(1, 2) = 255 : Color(1, 3) = 0
Color(2, 1) = 255 : Color(2, 2) = 0 : Color(2, 3) = 0
Color(3, 1) = 0 : Color(3, 2) = 255 : Color(3, 3) = 0
Color(4, 1) = 255 : Color(4, 2) = 0 : Color(4, 3) = 255
Color(5, 1) = 0 : Color(5, 2) = 255 : Color(5, 3) = 255
Color(6, 1) = 0 : Color(6, 2) = 0 : Color(6, 3) = 255
Color(7, 1) = 255 : Color(7, 2) = 255 : Color(7, 3) = 255
 
for i = 1 to Colors
 
	`Create media
	for y = 1 to 16
		for x = 1 to 16
 
			`Get the distance to the center
			d# = sqrt( (x-8)^2 + (y-8)^2 )
 
			`Calculate color based on the distance to the center
			if d# < 8.0
				value# = 1.0 / 8.0 * (8.0 - d#)
				ink rgb(Color(i, 1) * value#, Color(i, 2) * value#, Color(i, 3) * value#), 0
 
				`Draw dot (1x1 box is faster)
				box x, y, x + 1, y + 1
			endif
 
		next x
	next y
	get image i, 0, 0, 16, 16, 1
next i
 
 
`Create clock image
cls
ink rgb(255, 255, 255), 0
for i = 0 to 60
	x = 320 + (cos(i * 6.0)*175)
	y = 240 + (sin(i * 6.0)*175)
	box x-1, y-1, x+1, y+1
next i
for i = 1 to 12
	x = 312 + (cos(i * 30.0 - 90)*175)
	y = 232 + (sin(i * 30.0 - 90)*175)
	paste image 7, x, y
 
	`Text
	ink 0, 0
	center text x + 8, y + 4, str$(i)
next i
get image 10, 0, 0, screen width(), screen height(), 1
 
do
 
	`Clear the screen
	paste image 10, 0, 0
 
	`Get time
	time$ = get time$()
 
	`Get hours, minutes and seconds
	hours = val(left$(time$, 2))
	minutes = val(left$(right$(time$, 5), 2))
	seconds = val(right$(time$, 2))
 
	`Print time and values
	ink rgb(255, 255, 255), 0
	text 0, 0, time$
	text 0, 20, str$(hours) + " - " + str$(minutes) + " - " + str$(seconds)
 
	`Draw clock
 
	`Minutes
	for i = 1 to 4
		x = 312 + (cos(wrapvalue(-90 + (6.0*minutes) + (0.1*seconds))) * ((i-1)*25))
		y = 232 + (sin(wrapvalue(-90 + (6.0*minutes) + (0.1*seconds))) * ((i-1)*25))
		paste image 7, x, y, 1
	next i
 
	`Hours
	for i = 1 to 3
		x = 312 + (cos(wrapvalue(-90 + (30.0*hours) + (0.5*minutes))) * ((i-1)*25))
		y = 232 + (sin(wrapvalue(-90 + (30.0*hours) + (0.5*minutes))) * ((i-1)*25))
		paste image 1, x, y, 1
	next i
 
	`Seconds
	for i = 1 to 7
		x = 312 + (cos(wrapvalue(-90 + (6.0*seconds))) * ((i-1)*25))
		y = 232 + (sin(wrapvalue(-90 + (6.0*seconds))) * ((i-1)*25))
		paste image i, x, y, 1
	next i
 
	sync
loop