N2 3H2 = 2NH3 - fabrica-escola/artes-2o-ano-carmem-silva GitHub Wiki

image

# # Reação animada com programação 
elementos = [
    ("N", (100, 200), (300, 230)),  # símbolo, (x1, y1), (x2, y2)
    ("N", (100, 230), (300, 350)),
    ("H", (150, 300), (330, 230)),
    ("3", (150, 3000), (369, 360)),
    ("H", (150, 330), (330, 350)),
    ("3", (150, 4000), (369, 229)),
]

def setup():
    size(500, 500)

def draw():
    background(400, 240, 240)    
    textSize(30)
    for elemento in elementos:
        nome, (x1, y1), (x2, y2) = elemento
        fill(0, 0)   # translúcido
        text(nome, x1, y1)
        text(nome, x2, y2)
        fill(0)   # preto
        x3 = map(mouseX, 0, width, x1, x2)
        y3 = map(mouseX, 0, width, y1, y2)
        text(nome, x3, y3)#