TetrisSkyFallClock
Centered digital clock featuring a smooth rainbow color cycle and slow falling Tetris pieces.
About this flow
| System | AWTRIX NG Scripts |
|---|---|
| AWTRIX version | AWTRIX NG |
| Topic | Miscellaneous |
| Built by | RickyDeath79 |
| File | mmHDCZ8EmKeg.ax · 3.3 KB |
| Icons | — |
| Published | 11 Aug 2026 |
| Downloads | 57 |
Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
Flow description
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
Add this flow to your AWTRIX NG. It will start appearing on your display after installation.
Unable to connect? Download the flow and add it in the Scripts section of your AWTRIX. Advanced users can also use this command:
Discussion 0
Ask a question, suggest a change or share how you use it.
No comments yet. Start the conversation.
More flows for AWTRIX NG Scripts or Miscellaneous
Something wrong with this flow? Report it.
Have an idea?
Sign in to ask questions and join the conversation.