GithubHelp home page GithubHelp logo

rhubarbdog / microbit-scrolling-images Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 18 KB

Scroll text and images at any orientation on the microbit

License: MIT License

Python 100.00%
microbit micropython

microbit-scrolling-images's Introduction

Scroll - scrolling text and images at any orientation.

Is your microbit always at the wrong angle when using microbit.display methods? scroll.py could be the answer scroll combined images and text upside down, upwards or scroll down.

There are 2 functions and 2 useful helper functions,

scroll(message,delay=150,upside_down=False,monospace=False)
scrolls text and images horizontally, message can be a string, or a list/tuple of strings and images.
delay controlls how fast the image scrolls.
if upside_down is True then the text will be scrolled upside down.
if monospace is True all text and images will be 5 pixels wide seperated by a single blank line. Otherwise images and characters have exactly one pixel of space between them. Except for single quotes because two single quotes look exactly like one double quotes.

scroll_up(message,delay=150,scroll_down=False,monospace=False)
scrolls text and images vertically, by default messages scroll up. message can be a string, or a list/tuple of strings and images.
delay controlls how fast the image scrolls.
if scroll_down is True then the text will be scrolled down.
if monospace is True all text and images will be 5 pixels wide seperated by a single blank line. Otherwise images and characters have exactly one pixel of space between them. Except for single quotes because two single quotes look exactly like one double quotes.

both scroll functions wait until the animation is complete. Should the display be deactivated (microbit.display.is_on() is False) then nothing will be displayed, and the functions return immediately.

There are 2 helper functions to manipulate images.
rotate_image(image,clockwise=True) returns a new image rotated by 90 degrees. If clockwise is False then the image will be rotated anticlockwise.
reflect_image(image,in_x=True) returns a new image reflected in either the x axis or when argument in_x is False then in the y axis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.