diff --git a/examples/images/blue_rectangle.bmp b/examples/images/blue_rectangle.bmp new file mode 100644 index 0000000..2b048e4 Binary files /dev/null and b/examples/images/blue_rectangle.bmp differ diff --git a/examples/images/blue_rectangle.bmp.license b/examples/images/blue_rectangle.bmp.license new file mode 100644 index 0000000..4db0b86 --- /dev/null +++ b/examples/images/blue_rectangle.bmp.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 Foamyguy +# +# SPDX-License-Identifier: Unlicense \ No newline at end of file diff --git a/examples/images/green_circle.bmp b/examples/images/green_circle.bmp new file mode 100644 index 0000000..65479cd Binary files /dev/null and b/examples/images/green_circle.bmp differ diff --git a/examples/images/green_circle.bmp.license b/examples/images/green_circle.bmp.license new file mode 100644 index 0000000..4db0b86 --- /dev/null +++ b/examples/images/green_circle.bmp.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 Foamyguy +# +# SPDX-License-Identifier: Unlicense \ No newline at end of file diff --git a/examples/images/purple_oval.bmp b/examples/images/purple_oval.bmp new file mode 100644 index 0000000..2e8c2b3 Binary files /dev/null and b/examples/images/purple_oval.bmp differ diff --git a/examples/images/purple_oval.bmp.license b/examples/images/purple_oval.bmp.license new file mode 100644 index 0000000..4db0b86 --- /dev/null +++ b/examples/images/purple_oval.bmp.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 Foamyguy +# +# SPDX-License-Identifier: Unlicense \ No newline at end of file diff --git a/examples/images/yellow_square.bmp b/examples/images/yellow_square.bmp new file mode 100644 index 0000000..0df67e3 Binary files /dev/null and b/examples/images/yellow_square.bmp differ diff --git a/examples/images/yellow_square.bmp.license b/examples/images/yellow_square.bmp.license new file mode 100644 index 0000000..4db0b86 --- /dev/null +++ b/examples/images/yellow_square.bmp.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 Foamyguy +# +# SPDX-License-Identifier: Unlicense \ No newline at end of file diff --git a/examples/slideshow_alignment_test.py b/examples/slideshow_alignment_test.py new file mode 100644 index 0000000..387d77f --- /dev/null +++ b/examples/slideshow_alignment_test.py @@ -0,0 +1,52 @@ +""" +This example runs best on a PyPortal or other device with a +display larger than 128px in both directions. + +This example cycles through 4 different images and moves +them around to different positions on the screen each +time it updates by using the alignment feature. + +You must copy the images/ directory onto your CIRCUITPY drive. +""" +import board +from adafruit_slideshow import ( + PlayBackOrder, + SlideShow, + VerticalAlignment, + HorizontalAlignment, +) + +# pylint: disable=no-member + +# Create the slideshow object that plays through once alphabetically. +slideshow = SlideShow( + board.DISPLAY, None, folder="/images/", loop=True, order=PlayBackOrder.ALPHABETICAL, +) + +aligns = [ + (VerticalAlignment.TOP, HorizontalAlignment.CENTER), + (VerticalAlignment.TOP, HorizontalAlignment.RIGHT), + (VerticalAlignment.CENTER, HorizontalAlignment.LEFT), + (VerticalAlignment.CENTER, HorizontalAlignment.CENTER), + (VerticalAlignment.CENTER, HorizontalAlignment.RIGHT), + (VerticalAlignment.BOTTOM, HorizontalAlignment.LEFT), + (VerticalAlignment.BOTTOM, HorizontalAlignment.CENTER), + (VerticalAlignment.BOTTOM, HorizontalAlignment.RIGHT), + (VerticalAlignment.TOP, HorizontalAlignment.LEFT), +] +i = 0 +slideshow.h_align = aligns[i][1] +slideshow.v_align = aligns[i][0] +i += 1 + +prev_img = slideshow.current_image_name +while slideshow.update(): + cur_img = slideshow.current_image_name + if prev_img != cur_img: + slideshow.h_align = aligns[i][1] + slideshow.v_align = aligns[i][0] + i += 1 + if i >= len(aligns): + i = 0 + + prev_img = cur_img