TetrisSkyFallClock
Centered digital clock featuring a smooth rainbow color cycle and slow falling Tetris pieces.
| System | AWTRIX NG Scripts |
|---|---|
| Firmware | AWTRIX NG |
| Topic | Miscellaneous |
| Built by | RickyDeath79 |
| File | mmHDCZ8EmKeg.ax · 3.3 KB |
| Icons | — |
| Published | 11 Aug 2026 |
| Downloads | 3 |
1.Open the AWTRIX NG web interface.
2.Go to the Scripts tab and add a new script. (TetrisSkyFallClock).
3.Press Save.
4.Done
mmHDCZ8EmKeg.ax
# @name TetrisSkyFallClock
# @desc Reloj centrado con piezas de Tetris completas de 4 bloques (incluyendo Z Roja)
class TetrisSkyFallClock
var frame
var left_shape
var right_shape
var colors
def init()
self.frame = 0
self.left_shape = 0
self.right_shape = 5
# 7 colores oficiales de Tetris: Cyan, Azul, Naranja, Amarillo, Verde, Morado, Rojo
self.colors = [0x00FFFF, 0x3366FF, 0xFF8800, 0xFFFF00, 0x00FF00, 0xAA00FF, 0xFF2222]
end
def get_rainbow_color(step)
var pos = (step / 3) % 192
if pos < 64
return ( (255 - pos * 4) << 16 ) | ( (pos * 4) << 8 )
elif pos < 128
pos -= 64
return ( (255 - pos * 4) << 8 ) | (pos * 4)
else
pos -= 128
return ( (pos * 4) << 16 ) | (255 - pos * 4)
end
end
def draw_tetromino(px, py, shape_id)
var col = self.colors[shape_id % size(self.colors)]
if shape_id == 0
# I-Piece (Cyan) - Barra
pixel(px, py, col)
pixel(px, py + 1, col)
pixel(px, py + 2, col)
elif shape_id == 1
# J-Piece (Azul) - 4 bloques
pixel(px + 1, py, col)
pixel(px + 1, py + 1, col)
pixel(px, py + 1, col)
elif shape_id == 2
# L-Piece (Naranja) - 4 bloques
pixel(px, py, col)
pixel(px, py + 1, col)
pixel(px + 1, py + 1, col)
elif shape_id == 3
# O-Piece (Amarillo) - Cuadrado 2x2 (4 bloques)
pixel(px, py, col)
pixel(px + 1, py, col)
pixel(px, py + 1, col)
pixel(px + 1, py + 1, col)
elif shape_id == 4
# S-Piece (Verde) - 4 bloques
pixel(px + 1, py, col)
pixel(px + 2, py, col)
pixel(px, py + 1, col)
pixel(px + 1, py + 1, col)
elif shape_id == 5
# T-Piece (Morado) - 4 bloques
pixel(px + 1, py, col)
pixel(px, py + 1, col)
pixel(px + 1, py + 1, col)
pixel(px + 2, py + 1, col)
else
# Z-Piece (Rojo) - 4 bloques completos (corregido)
pixel(px, py, col)
pixel(px + 1, py, col)
pixel(px + 1, py + 1, col)
pixel(px + 2, py + 1, col)
end
end
def draw()
clear()
var h = hour()
var m = minute()
if h < 0
h = 18
m = 40
end
self.frame += 1
# 1. Calcular caida pausada (/ 6)
var py_left = (self.frame / 6) % 12 - 3
var py_right = ((self.frame + 18) / 6) % 12 - 3
# Cambiar de pieza de Tetris al completar la caida
if py_left == -3 && (self.frame % 6 == 0)
self.left_shape = (self.left_shape + 1) % 7
end
if py_right == -3 && ((self.frame + 18) % 6 == 0)
self.right_shape = (self.right_shape + 2) % 7
end
# Dibujar pieza izquierda y derecha con sus 4 bloques completos
self.draw_tetromino(1, py_left, self.left_shape)
self.draw_tetromino(28, py_right, self.right_shape)
# 2. Formatear la hora "HH:MM" con colon centrado
var h_str = h < 10 ? "0" + str(h) : str(h)
var m_str = m < 10 ? "0" + str(m) : str(m)
var show_dots = (second() % 2) == 0
var t_str = h_str + (show_dots ? ":" : " ") + m_str
var txt_w = text_ink_width(t_str)
var start_x = (width() - txt_w) / 2
# Sombra del texto
text(start_x + 1, 7, t_str, 0x111122)
# 3. Hora principal con transicion de color arcoiris
var clock_color = self.get_rainbow_color(self.frame)
text(start_x, 6, t_str, clock_color)
end
end
return TetrisSkyFallClock()
Install it on your AWTRIX NG
Your browser writes the script straight to the device on your network. It joins the app rotation right away.
Some browsers refuse to talk to a device on your network from a public page. Download the flow and paste it into the Scripts tab of your device, or install it from a terminal:
More flows for AWTRIX NG Scripts or Miscellaneous
Something wrong with this flow? Report it.