Ejemplo n.º 1
0
}, {
    "file": "fire.gif",
    "fps": 3,
    "x": 40
}, {
    "file": "goomba.gif",
    "fps": 1,
    "x": 60
}, {
    "file": "qblock.gif",
    "fps": 5,
    "x": 80
}]

sign = farnsworth.sign(provides_logo=False,
                       is_dynamic=True,
                       preferred_duration=5.0)

for gif in gifs:
    gif["file"] = sign.locate_file(gif["file"])
    gif["sprite"] = farnsworth.sprite(gif_source=gif["file"],
                                      scale_y_to=config.PIXELS_HIGH)
    gif["sprite"].move_to(gif["x"], 0)
    gif["clock"] = farnsworth.clock(1.0 / gif["fps"])

while True:

    sign.front_layer().blank()

    for gif in gifs:
        if gif["clock"].tick():
Ejemplo n.º 2
0
#!/usr/bin/python

import math

import farnsworth
import config
import constants

def blue_rings( x, y, clock ):

  period = clock * 0.01 + 0.3
  offset = 0
  seed = math.sqrt((x - config.PIXELS_ACROSS / 2.0) * (x - config.PIXELS_ACROSS / 2.0) + (y - config.PIXELS_HIGH / 2.0) * (y - config.PIXELS_HIGH / 2.0)) / 8.0
  scale = math.sin((seed/period - offset) * math.pi * 2) / 2 + 0.5
  b = int(255.0 * scale)
  r = 0
  g = 0

  return (g,r,b)

sign = farnsworth.sign( provides_logo=False,
                        is_dynamic=True,
                        preferred_duration=5.0 )

while True:

  sign.paint_from_rule(blue_rings)
  sign.front_layer().render_glyph('CENTER','CENTER','FONT_5x7','HEART',constants.COLORS['RED']);
  sign.paint()