Created
April 29, 2018 16:53
-
-
Save Saren-Arterius/826c54c57de5fbffd132cb3c973ce98b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from time import sleep | |
| CURSOR_UP_ONE = '\x1b[1A' | |
| ERASE_LINE = '\x1b[2K' | |
| def rf(): | |
| print(CURSOR_UP_ONE + ERASE_LINE + CURSOR_UP_ONE) | |
| def p(i): | |
| print('[' + (i * '|') + ((70 - i) * ' ') + ']') | |
| def main(): | |
| state = 0 | |
| cnt = 20 | |
| i = 0 | |
| while True: | |
| p(i) | |
| if i == 70: | |
| for i in range(5): | |
| for i in range(71): | |
| sleep((i ** 0.9) * 0.0006) | |
| rf() | |
| p(i) | |
| sleep(3) | |
| rf() | |
| for i in range(70, 0, -1): | |
| p(i) | |
| sleep(1 / i) | |
| rf() | |
| exit() | |
| elif state == 0: | |
| i += 1 | |
| cnt -= 1 | |
| if cnt == 0: | |
| state = 1 | |
| cnt = 18 | |
| elif state == 1: | |
| i -= 1 | |
| cnt -= 1 | |
| if cnt == 0: | |
| state = 0 | |
| cnt = 20 | |
| sleep(0.01) | |
| rf() | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment