adafruit_displayio_flipclock
¶
DisplayIO widgets for showing flip clock style animations changing from one number to another.
Author(s): Tim Cocks
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
adafruit_displayio_flipclock.flip_digit
¶
DisplayIO widgets for a single digit that supports “flip clock” style animations when changing the value showing.
Author(s): Tim Cocks
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class adafruit_displayio_flipclock.flip_digit.FlipDigit(static_spritesheet: Bitmap, static_spritesheet_palette: Palette, top_anim_spritesheet: Bitmap, top_anim_palette: Palette, bottom_anim_spritesheet: Bitmap, bottom_anim_palette: Palette, tile_width: int, tile_height: int, anim_frame_count: int = 10, anim_delay: float = 0.02, dynamic_fading: bool = True, brighter_level: float = 0.85, darker_level: float = 0.6, medium_level: float = 0.8)¶
DisplayIO widgets for a single digit that supports “flip clock” style animations when changing the value showing. User must load static and animation spritesheets and pass them in for initialization.
- Parameters:
static_spritesheet (Bitmap) – Spritesheet image of static numbers sprites.
static_spritesheet_palette (Palette) – Palette to use with the static sprite sheet. set all desired transparent or opaque indexes before initializing.
top_anim_spritesheet (Bitmap) – Spritesheet image of top half animation sprites.
top_anim_palette (Palette) – Palette to use with the top half animation sprites. set all desired transparent or opaque indexes before initializing.
bottom_anim_spritesheet (Bitmap) – Spritesheet image of bottom half animation sprites.
bottom_anim_palette (Palette) – Palette to use with the bottom half animation sprites. set all desired transparent or opaque indexes before initializing.
tile_width (int) – Width in pixels of the animation sprite tiles.
tile_height (int) – Height in pixels of the animation sprite tiles. NOTE: this value should be 1/2 the height of the full static digit sprite. Animations cover top and bottom half respectively.
anim_frame_count (int) – The number of frames in the flip animations. Default value is 10 which is the number contained in the example spritesheets.
anim_delay (float) – Time in seconds to wait between animation frames. Default value is 0.02 seconds
dynamic_fading (bool) – Whether to use PaleteFadder to dynamically adjust brightness.
brighter_level (float) – Brightness modifier value to use for the brightest portion of the animations. Valid range is 0.0 - 1.0.
medium_level (float) – Brightness modifier value to use for the standard portion of the animations. And the static digit sprites. Valid range is 0.0 - 1.0.
darker_level (float) – Brightness modifier value to use for the darkest “shadow” portion of the animations. Valid range is 0.0 - 1.0.
scale (int) – Scale of layer pixels in one dimension.
x (int) – Initial x position within the parent.
y (int) – Initial y position within the parent.
- bottom_flip_animate(value: int) None ¶
Blocking function that displays the bottom animation sprites sequentially sleeping for anim_delay between each.
adafruit_displayio_flipclock.flip_clock
¶
DisplayIO widget that shows two sets of two digit pairs. It supports “flip clock” style animations when changing to different values.
Author(s): Tim Cocks
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class adafruit_displayio_flipclock.flip_clock.FlipClock(static_spritesheet: Bitmap, static_spritesheet_palette: Palette, top_anim_spritesheet: Bitmap, top_anim_palette: Palette, bottom_anim_spritesheet: Bitmap, bottom_anim_palette: Palette, tile_width: int, tile_height: int, anim_frame_count: int = 10, anim_delay: float = 0.02, colon_color: int = 16777215, dynamic_fading: bool = False, brighter_level: float = 0.85, darker_level: float = 0.6, medium_level: float = 0.8)¶
A FlipClock displayio widget that shows two pairs of digits and uses flip clock style animations to change between them.
- Parameters:
static_spritesheet (Bitmap) – Spritesheet image of static numbers sprites.
static_spritesheet_palette (Palette) – Palette to use with the static sprite sheet. set all desired transparent or opaque indexes before initializing.
top_anim_spritesheet (Bitmap) – Spritesheet image of top half animation sprites.
top_anim_palette (Palette) – Palette to use with the top half animation sprites. set all desired transparent or opaque indexes before initializing.
bottom_anim_spritesheet (Bitmap) – Spritesheet image of bottom half animation sprites.
bottom_anim_palette (Palette) – Palette to use with the bottom half animation sprites. set all desired transparent or opaque indexes before initializing.
tile_width (int) – Width in pixels of the animation sprite tiles.
tile_height (int) – Height in pixels of the animation sprite tiles. NOTE: this value should be 1/2 the height of the full static digit sprite. Animations cover top and bottom half respectively.
anim_frame_count (int) – The number of frames in the flip animations. Default value is 10 which is the number contained in the example spritesheets.
anim_delay (float) – Time in seconds to wait between animation frames. Default value is 0.02 seconds
colon_color (int) – Hex color value to draw the colon between pairs of digits. Default is white 0xffffff.
dynamic_fading (bool) – Whether to use PaleteFadder to dynamically adjust brightness.
brighter_level (float) – Brightness modifier value to use for the brightest portion of the animations. Valid range is 0.0 - 1.0.
medium_level (float) – Brightness modifier value to use for the standard portion of the animations. Valid range is 0.0 - 1.0.
darker_level (float) – Brightness modifier value to use for the darkest “shadow” portion of the animations. Valid range is 0.0 - 1.0.
scale (int) – Scale of layer pixels in one dimension.
x (int) – Initial x position within the parent.
y (int) – Initial y position within the parent.