Code Monkey home page Code Monkey logo

bash_loading_animations's Introduction

The ultimate collection of loading animations for Bash

Ready-to-use loading animations in ASCII and UTF-8 for easy integration into your Bash scripts.

Have an idea for a nice-looking animation? Please help expand the collection!

Important note: do not copy the raw script file from your browser or you will have broken animations, as the non-breaking spaces will be converted into regular spaces.

Instead, use one of the following methods to retrieve the script:

git clone https://github.com/Silejonu/bash_loading_animations
curl -O https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.sh
curl -O https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.demo
wget https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.sh
wget https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.demo

Run the provided script bash_loading_animations.demo to quickly visualise the available animations.

Add support for loading animations to your script

Put these lines at the top of your script:

# Load in the functions and animations
source /path/to/bash_loading_animations.sh
# Run BLA::stop_loading_animation if the script is interrupted
trap BLA::stop_loading_animation SIGINT

Don't forget to replace /path/to/bash_loading_animations.sh with the appropriate filepath.

Show a loading animation for foo

Show a loading animation for the command foo:

BLA::start_loading_animation "${BLA_name_of_the_animation[@]}"
foo
BLA::stop_loading_animation

If foo prints some output in the terminal, you may want to add:

foo 1> /dev/null # hide standard output
# or
foo 2> /dev/null # hide error messages
# or
foo &> /dev/null # hide all output

Some of the animations have been adapted from https://github.com/sindresorhus/cli-spinners.

bash_loading_animations's People

Contributors

matthewpersico avatar silejonu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bash_loading_animations's Issues

[New animation]

Animation(s)

box=( 0.25 ◰ ◳ ◲ ◱)
arrows=(← ↖ ↑ ↗ → ↘ ↓ ↙)

 BWhite='\033[1;37m'       # Bold White
 BGreen='\033[1;32m'       # Bold Green
 BRed='\033[1;31m'         # Bold Red
 BYellow='\033[1;33m'      # Bold Yellow
 BPurple='\033[1;35m'      # Bold Purple
 Color_Off='\033[0m'       # Text Reset

coloreddots=(${BWhite}.${Color_Off}${BGreen}.${Color_Off}${BRed}.${Color_Off}${BYellow}.${Color_Off}${BPurple}.${Color_Off} 
${BWhite}°${Color_Off}${BGreen}.${Color_Off}${BRed}.${Color_Off}${BYellow}.${Color_Off}${BPurple}.${Color_Off} 
${BWhite}.${Color_Off}${BGreen}°${Color_Off}${BRed}.${Color_Off}${BYellow}.${Color_Off}${BPurple}.${Color_Off} 
${BWhite}.${Color_Off}${BGreen}.${Color_Off}${BRed}°${Color_Off}${BYellow}.${Color_Off}${BPurple}.${Color_Off} 
${BWhite}.${Color_Off}${BGreen}.${Color_Off}${BRed}.${Color_Off}${BYellow}°${Color_Off}${BPurple}.${Color_Off} 
${BWhite}.${Color_Off}${BGreen}.${Color_Off}${BRed}.${Color_Off}${BYellow}.${Color_Off}${BPurple}°${Color_Off})

[New animation] I needed something retro style for my project and ended up with this, hope you like it :)

Animation(s)

BLA_so_long=(
					0.25
					'█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████████████▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████████████▒▒▒▒▒▒▒▒▒▒▒' '██████████████████████▒▒▒▒▒▒▒▒▒▒' '███████████████████████▒▒▒▒▒▒▒▒▒' '████████████████████████▒▒▒▒▒▒▒▒' '█████████████████████████▒▒▒▒▒▒▒' '██████████████████████████▒▒▒▒▒▒' '███████████████████████████▒▒▒▒▒' '████████████████████████████▒▒▒▒' '█████████████████████████████▒▒▒' '██████████████████████████████▒▒' '███████████████████████████████▒' '████████████████████████████████')

Adapted spinner from alive-progress python module

Animation(s)

alive_progress=(0.05 '▁▂▃' '▂▃▄' '▃▄▅' '▄▅▆' '▅▆▇' '▆▇█' '▇█▇' '█▇▆' '▇▆▅' '▆▅▄' '▅▄▃' '▄▃▂' '▃▂▁' '▂▁▂')

bouncy_ball

Animation(s)

bouncy_ball=(0.15 ⡀ ╷ ⠂ ⠁ ⠂ ╷ ⡀ _)

The animation gets wrapped up with words "echo/read" command

I've cloned your repo as instructed.
But when i run the script below, the animation gets wrapped up with letters (see in video)

I want the animation to always work until the end of script and without wrapping with any letters/words.

#!/usr/bin/env bash

source ~/Desktop/david/bash_loading_animations/bash_loading_animations.sh
trap BLA::stop_loading_animation SIGINT

BLA::start_loading_animation "${BLA_braille_whitespace[@]}"

echo -ne "Write something: "
read sth

echo "You have written: $sth "

BLA::stop_loading_animation
bash.animation.bug.mp4

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.