Skip to main content

Crafting Delight: A Journey into ASCII Animation with a Cute Expression Cat

Introduction: Welcome to the mesmerizing world of ASCII animation, where art and code converge to create captivating visual experiences. In this blog post, we embark on an enchanting journey as we explore the creation of a delightful animation featuring a cute expression cat. Join us as we delve into the magic of ASCII art and the artistry of code, unraveling the process behind bringing this charming feline to life. The Script:   Bringing Characters to Life At the core of this animation lies a bash script that serves as the vessel for artistic expression. The provided code snippet sets the stage by hiding the cursor and defining the essential function for displaying each frame. This function is the key to rendering the evolving expressions of our cute cat, bringing forth a dynamic visual symphony. #!/bin/bash tput civis display_frame(){         local text = ( " $@ " )         local rows = ${#text[ @ ]}         local col...

Crafting Delight: A Journey into ASCII Animation with a Cute Expression Cat

Introduction:

Welcome to the mesmerizing world of ASCII animation, where art and code converge to create captivating visual experiences. In this blog post, we embark on an enchanting journey as we explore the creation of a delightful animation featuring a cute expression cat. Join us as we delve into the magic of ASCII art and the artistry of code, unraveling the process behind bringing this charming feline to life.

The Script: 

Bringing Characters to Life At the core of this animation lies a bash script that serves as the vessel for artistic expression. The provided code snippet sets the stage by hiding the cursor and defining the essential function for displaying each frame. This function is the key to rendering the evolving expressions of our cute cat, bringing forth a dynamic visual symphony.

#!/bin/bash


tput civis


display_frame(){

        local text=("$@")

        local rows=${#text[@]}

        local cols=${#text[0]}

        local start_row=$(( ( $(tput lines) - rows ) / 2 ))

        local start_col=$(( ( $(tput cols) - cols ) / 2 ))

        clear

        for (( i=0; i<rows; i++ )); do

                tput cup $(( start_row + i )) $start_col

                echo -e "${text[$i]}"

        done

        sleep 0.5


}


animation_name=$(cat animation_name)

cd $animation_name/


frames=$(cat frameList)

while true; do


        for frame in $frames; do


                frameText=()

                while IFS= read -r line; do

                        frameText+=("$line")

                done < "$frame"


                display_frame "${frameText[@]}"


        done

done

tput cnorm



Code Explanation:
  1. tput civis: This command hides the cursor, ensuring a cleaner visual output during the animation.
  2. display_frame() function: This function is responsible for displaying each frame of the animation.
  3. local start_row=$(( ( $(tput lines) - rows ) / 2 )): The start_row variable calculates the starting row position for displaying the frame. It ensures that the frame is vertically centered on the terminal screen by subtracting the number of rows in the frame from the total number of lines in the terminal and dividing by 2.
  4. local start_col=$(( ( $(tput cols) - cols ) / 2 )): The start_col variable calculates the starting column position for displaying the frame. Similar to start_row, it ensures the frame is horizontally centered on the terminal screen by subtracting the number of columns in the frame from the total number of columns in the terminal and dividing by 2.
  5. tput cup $(( start_row + i )) $start_col: The tput cup command moves the cursor to the specified row and column position, allowing us to print the lines of the frame at the correct position.
  6. while IFS= read -r line; do: This loop reads each line from the current frame file.
  7. tput cnorm: Finally, this command restores the cursor.

Frame by Frame: Evoking Emotion 

The heart of the animation lies in the individual frames, each meticulously crafted to portray a specific expression. Stored in separate files, these frames are read and displayed in a sequential manner, creating a seamless transition that evokes a range of emotions. As the frames unfold, the cat's expressions come to life—curiosity, playfulness, surprise, and more—captivating the viewer with their whimsical charm.

Unleashing Creativity: Customizing the Animation

One of the most exciting aspects of ASCII animation is the ability to customize and experiment. By modifying the frame files, artists and coders can create their own unique expressions, gestures, or even entirely new characters. This creative freedom allows for endless possibilities and encourages individuals to infuse their imagination into the animation.

Experiencing the Magic: The Video Showcase 

To truly appreciate the beauty of this ASCII animation, a video showcase is provided in the accompanying blog post. It allows readers to witness the seamless transitions and captivating expressions of the cute expression cat. Immerse yourself in the magic of ASCII animation and let its charm delight your senses.

Conclusion: 

Where Art and Code Collide In this blog post, we've embarked on a journey through the realm of ASCII animation, guided by a cute expression cat. By blending art and code, we've witnessed how characters on a screen can come alive, evoking emotions and captivating our imagination. The provided bash script serves as a starting point for your own creative explorations, inviting you to dive deeper into the captivating world of ASCII animation.

Remember, the beauty of ASCII animation lies not only in the final product but also in the process of creation. Embrace the magic, unleash your creativity, and let your characters dance across the screen, enchanting audiences with their whimsy.

Thanks,

Comments